Last active
August 29, 2015 14:16
-
-
Save toke/c0839b4da0ea52044e18 to your computer and use it in GitHub Desktop.
Ngninx Proxy Auth
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Server { | |
… | |
location / { | |
auth_basic "closed site"; | |
auth_basic_user_file conf/htpasswd; | |
} | |
location /b { | |
allow 192.168.1.1/24; | |
allow 127.0.0.1; | |
deny 192.168.1.2; | |
deny all; | |
} | |
location /c { | |
satisfy any; | |
allow 192.168.1.0/24; | |
deny all; | |
auth_basic "closed site"; | |
auth_basic_user_file conf/htpasswd; | |
} | |
… | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Server { | |
listen 80; | |
server_name example.com www.example.com; | |
charset utf-8; | |
location / { | |
proxy_pass http://localhost:8080; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_buffer_size 8k; | |
proxy_buffers 16 32k; | |
proxy_busy_buffers_size 64k; | |
} | |
location ~ /(.git|.svn) { | |
deny all; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
… | |
rewrite ^ https://example.com$request_uri? permanent; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Server { | |
listen 443; | |
… | |
ssl on; | |
ssl_certificate /etc/nginx/cert.pem; | |
ssl_certificate_key /etc/nginx/cert.key; | |
ssl_session_timeout 5m; | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
ssl_ciphers 'EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH:+CAMELLIA256:+AES256:+CAMELLIA128:+AES128:+SSLv3:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4:!SEED:!ECDSA:CAMELLIA256-SHA:AES256-SHA:CAMELLIA128-SHA:AES128-SHA'; | |
ssl_prefer_server_ciphers on; | |
… | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment