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

rebornishard

Member
Oct 30, 2012
12
0
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
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,202
363
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.
 

rebornishard

Member
Oct 30, 2012
12
0
1
cPanel Access Level
Root Administrator
Make sure that whatever IP nginx is directing the traffic to is the same IP configured for the site within Apache.
hello vanessa, thanks to reply
i want to caching it, so it get the page once then show it on another server

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.
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
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,202
363
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.