Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Re: How to allow access to a URL from only a selected IP

$
0
0
Working :) I had a trailing "/" after 8080 that was breaking it

server {
listen 80;
server_name 192.168.1.25;
return 301 https://$server_name$request_uri;
}

server {
listen 443 ssl;
server_name 192.168.1.25;

root /var/www/html;

index index.html index.htm index.nginx-debian.html;

ssl_certificate /etc/ssl/openhab.crt;
ssl_certificate_key /etc/ssl/openhab.key;

location / {
proxy_pass http://localhost:8080;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

auth_basic "Username and Password Required";
auth_basic_user_file /etc/nginx/.htpasswd;

}

location ^~ /paperui {
proxy_pass http://localhost:8080;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

allow 192.168.1.51;
deny all;

auth_basic "Username and Password Required";
auth_basic_user_file /etc/nginx/.htpasswd;

}

}

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>