Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Use VPS as reverse proxy for site hosted on shared hosting.
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Use VPS as reverse proxy for site hosted on shared hosting.

I want to create a setup where a VPS (I'm thinking maybe Ubuntu and Ngnix) would act as a reverse proxy for a website hosted on cPanel shared hosting. What would be the best way to go about setting up something like that?

Comments

  • Rent vps nearest you target audience, install nginx, setup reverse proxy.
    Done

  • @neps said:
    I want to create a setup where a VPS (I'm thinking maybe Ubuntu and Ngnix) would act as a reverse proxy for a website hosted on cPanel shared hosting. What would be the best way to go about setting up something like that?

    nginx proxy_pass does everything you need, works pretty well imo. You can also set it to cache content.

  • Yes, exactly as suggested by above forum members, it would be a easy task to do.

    The easiest configuration for using nginx would be something like this:

    server {
            listen   vps_ip:80;
            server_name whatever.k0nsl.org;
    
    location / {
    proxy_pass http://shared_hosting_ip:80;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
    }
    }
    

    You can of course make it more "complicated", if you want to.

    Thanked by 1bersy
  • You could also consider cloudflare if you dont want to roll your own nginx. Reverse proxy WITH CACHE is what you want. Really kick the speed up and lower requests to your host.

  • @k0nsl said:
    Yes, exactly as suggested by above forum members, it would be a easy task to do.

    The easiest configuration for using nginx would be something like this:

    server {
            listen   vps_ip:80;
            server_name whatever.k0nsl.org;
    
    location / {
    proxy_pass http://shared_hosting_ip:80;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
    }
    }
    

    You can of course make it more "complicated", if you want to.

    Well, you should (technically) forward the IP with that (you can change the variables, but again, you'd be complicating things like @k0nsl said):

    server {
            listen   vps_ip:80;
            server_name whatever.k0nsl.org;
    
    location / {
    proxy_pass http://shared_hosting_ip:80;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
    proxy_set_header REAL_ADDR $remote_addr;
    }
    }
    
  • However, if it isn't a dedicated IP address that you own, you'll have to go and change the domain of your cPanel account to something like proxy.yourwebsite.com and setup a NGINX proxy on yourwebsite.com to send all requests directly to proxy.yourwebsite.com.

  • @FlamesRunner said:
    However, if it isn't a dedicated IP address that you own, you'll have to go and change the domain of your cPanel account to something like proxy.yourwebsite.com and setup a NGINX proxy on yourwebsite.com to send all requests directly to proxy.yourwebsite.com.

    Well they can use hostname, its just a bit slower. Nothing noticable for them I would bet. IP is the best for reverse_proxy but hostname will work as well.

  • @jollymon said:
    You could also consider cloudflare if you dont want to roll your own nginx. Reverse proxy WITH CACHE is what you want. Really kick the speed up and lower requests to your host.

    This is the setup I have right now. Would using an additional layer of Nginx caching between my server and Cloudflare have a positive effect?

  • How long is nginx caching a dns look up result? Don't tell me that it needs to ask its dns resolver each time someone visits the reverse proxy.

    jollymon said: Well they can use hostname, its just a bit slower. Nothing noticable for them I would bet. IP is the best for reverse_proxy but hostname will work as well.

  • @neps said:
    This is the setup I have right now. Would using an additional layer of Nginx caching between my server and Cloudflare have a positive effect?

    So you are using cloudflare and its not fast? I am thinking that some headers are wrong most likely someplace along the way. Cpanel hosted websites really are not built for raw speed. Its that tradeoff for convenience thing.

Sign In or Register to comment.