Hi,
I want to allow access to certain locations on my web server (e.g. phpMyAdmin) to local IPs only.
When using Apache, I had the following content in .htaccess:
----------------------------------------------------------------------------------------
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^192\.168\.1\.*
RewriteRule ^phpMyAdmin($|/) - [L,R=403]
RewriteCond %{REMOTE_ADDR} !^192\.168\.1\.*
RewriteRule ^phpvirtualbox($|/) - [L,R=403]
RewriteCond %{REMOTE_ADDR} !^192\.168\.1\.*
RewriteRule ^Wiki($|/) - [L,R=403]
----------------------------------------------------------------------------------------
In an nginx conf file, I tried to solve the same as follows:
----------------------------------------------------------------------------------------
server {
listen 80;
server_name 192.168.1.110;
location /phpMyAdmin/ {
allow 192.168.1.0/24;
deny all;
}
}
----------------------------------------------------------------------------------------
This, however, doesn't seem to work - I get a 404 error. Does anyone know why? Also, I would like any denied IPs to be redirected to 403.
Any help is appreciated!
Thank you, MI6
I want to allow access to certain locations on my web server (e.g. phpMyAdmin) to local IPs only.
When using Apache, I had the following content in .htaccess:
----------------------------------------------------------------------------------------
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^192\.168\.1\.*
RewriteRule ^phpMyAdmin($|/) - [L,R=403]
RewriteCond %{REMOTE_ADDR} !^192\.168\.1\.*
RewriteRule ^phpvirtualbox($|/) - [L,R=403]
RewriteCond %{REMOTE_ADDR} !^192\.168\.1\.*
RewriteRule ^Wiki($|/) - [L,R=403]
----------------------------------------------------------------------------------------
In an nginx conf file, I tried to solve the same as follows:
----------------------------------------------------------------------------------------
server {
listen 80;
server_name 192.168.1.110;
location /phpMyAdmin/ {
allow 192.168.1.0/24;
deny all;
}
}
----------------------------------------------------------------------------------------
This, however, doesn't seem to work - I get a 404 error. Does anyone know why? Also, I would like any denied IPs to be redirected to 403.
Any help is appreciated!
Thank you, MI6