NGINX rewrite IP to Domain Name
You can try to add this into Nginx's "additional directives" in UI:
location /forums { try_files $uri $uri/ /index.php;}location ~^(/forums/page/).*(\.php)$ { try_files $uri $uri/ /index.php;}# Mask fake admin directorylocation ~^/forums/admin/(.*)$ { deny all;}# IP.Board PHP/CGI Protectionlocation ~^(/forums/uploads/).*(\.php)$ { deny all;}location ~^(/forums/hooks/).*(\.php)$ { deny all;}location ~^(/forums/cache/).*(\.php)$ { deny all;}location ~^(/forums/screenshots/).*(\.php)$ { deny all;}location ~^(/forums/downloads/).*(\.php)$ { deny all;}location ~^(/forums/blog/).*(\.php)$ { deny all;}location ~^(/forums/public/style_).*(\.php)$ { deny all;}
I've ignore all system-wide and commented settings. Also you can try to add content from
include /usr/local/nginx/conf/staticfiles.conf;include /usr/local/nginx/conf/php.conf;include /usr/local/nginx/conf/drop.conf;
Pay attention that your web site root is placed into /httpdocs
folder, according to this config I've see that you web root was in public
directory.
Most easy way is to set default domain
for IP xx.xx.xx.xx
to domain.com
in Tools & Settings > IP addreses > xx.xx.xx.xx
Also you can create .htaccess
file in web root of domain.com
with content:
RewriteEngine on RewriteCond %{HTTP_HOST} ^xx\.xx\.xx\.xxRewriteRule (.*) http://domain.com/$1 [R=302,L]
Why it does not work via Additional directives?
- plesk include custom directives inside of nginx domain's server{} - so server inside server is not possible. It's by design.
- custom directives includinв at the end of nginx domain's server{} so if request was catch by some upper rule or location all other will be ignored for this request.