HHawk
Regular Pleskian
We switched one of our personal domains from FastCGI to nginx, however I am experiencing some issues with applying "RewriteCond" into the "Additional nginx directives" for this domain / hostingaccount.
The idea behind it, is that I want to redirect everyone to disney.com who's IP's aren't in the list of allowed IP's.
For example we are using the following .htaccess file (see below) in FastCGI to redirect everyone (but our own IP's) to disney.com. In this situation we are able to visit the site while it's under construction and everyone else is redirected to disney.com.
However nginx doesn't use .htaccess and therefor you have to add it in Plesk's CP under "Additional nginx directives". I did a search on Google and though I got a few hits, none of them explained how to do this with multiple IP's.
Our current "Additional nginx directives" contains only the following:
If I try to use "geo" in there I get the following error: "Invalid nginx configuration: nginx: [emerg] "geo" directive is not allowed here in". If use "location" or "server" I also get errors...
Can anyone give me a working example on how to apply our current .htaccess rules, as described above, in nginx?
Thank you in advance for your help.
The idea behind it, is that I want to redirect everyone to disney.com who's IP's aren't in the list of allowed IP's.
For example we are using the following .htaccess file (see below) in FastCGI to redirect everyone (but our own IP's) to disney.com. In this situation we are able to visit the site while it's under construction and everyone else is redirected to disney.com.
Code:
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^88\.33\.160\.132$
RewriteCond %{REMOTE_ADDR} !^214\.166\.12\.70$
RewriteCond %{REMOTE_ADDR} !^69\.232\.83\.[0-9]{1,3}$
RewriteRule .? http://disney.com/ [L]
However nginx doesn't use .htaccess and therefor you have to add it in Plesk's CP under "Additional nginx directives". I did a search on Google and though I got a few hits, none of them explained how to do this with multiple IP's.
Our current "Additional nginx directives" contains only the following:
Code:
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript image/svg+xml application/x-font-ttf font/opentype;
location ~* \.(?:ico|css|js|gif|jpe?g|png|svg|woff)$ {
expires 30d;
add_header Pragma public;
add_header Cache-Control "public";
proxy_read_timeout 90;
fastcgi_read_timeout 90;
}
If I try to use "geo" in there I get the following error: "Invalid nginx configuration: nginx: [emerg] "geo" directive is not allowed here in". If use "location" or "server" I also get errors...
Can anyone give me a working example on how to apply our current .htaccess rules, as described above, in nginx?
Thank you in advance for your help.