The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

allow another ip / domain to use nginx reverse proxy to cpanel hosted website

Discussion in 'General Discussion' started by rebornishard, Jul 21, 2014.

  1. rebornishard

    rebornishard Member

    Joined:
    Oct 30, 2012
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hello all,
    i tried to reverse proxy a website using a server with nginx
    and targeted cpanel hosted website
    but it always ended up with default apache page

    what i must do? add anoter server ip from whm or terminal to allowing it

    thanks
     
  2. vanessa

    vanessa Well-Known Member
    PartnerNOC

    Joined:
    Sep 26, 2006
    Messages:
    817
    Likes Received:
    22
    Trophy Points:
    18
    Location:
    Virginia Beach, VA
    cPanel Access Level:
    DataCenter Provider
    Re: allow anoter ip / domain to use nginx reverse proxy to cpanel hosted website

    Make sure that whatever IP nginx is directing the traffic to is the same IP configured for the site within Apache.
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    653
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    Typically, in cases where the default website appears, it's because the access attempt is over an IP address the VirtualHost is not setup with. Make sure the domain name is assigned the same IP address it's pointed to.

    Thank you.
     
  4. rebornishard

    rebornishard Member

    Joined:
    Oct 30, 2012
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    hello vanessa, thanks to reply
    i want to caching it, so it get the page once then show it on another server

    hello michael, thanks to reply
    yes i point it to domain, is there something wrong with my conf ?

    here my config :
    Code:
    location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
           access_log off; log_not_found off; expires max;
    }
    
        location / {
                proxy_set_header X-Real-IP  $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header Host $host;
                proxy_pass http://domain.com;
        }
        
    location = /favicon.ico {
    	log_not_found off;
    	access_log off;
    }
    location = /robots.txt {
    	allow all;
    	log_not_found off;
    	access_log off;
    }
    location ~ /\. {
    	deny all;
    }
    location ~* /(?:uploads|files)/.*\.php$ {
    	deny all;
    }
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    
    thank you
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    653
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    I don't see anything wrong with the configuration itself, but note that it falls outside cPanel's scope of support. You may want to consult with a qualified system administrator for assistance with this type of setup.

    Thank you.
     
Loading...

Share This Page