Last active
October 19, 2015 08:47
-
-
Save kenzo0107/bab265d0e8c761576e24 to your computer and use it in GitHub Desktop.
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 www.hostname; | |
return 301 http://127.0.0.1:9000$request_uri; | |
} | |
server { | |
listen 80; | |
server_name hostname; | |
# prefixがregister, mypage, login, logout で始まるパスの場合、 httpsへ301リダイレクト | |
location ~ ^/(register|mypage|login|logout) { | |
return 301 https://127.0.0.1:9000$request_uri; | |
} | |
# 静的ファイル配信・キャッシュ1d(1日)・アクセスログ off 設定 | |
location /public/ { | |
root /usr/share/nginx/html/; | |
expires 1d; | |
access_log off; | |
} | |
# 上記以外はhttp通信を行う | |
location / { | |
root /usr/share/nginx/html; | |
proxy_pass http://127.0.0.1:9000; | |
} | |
} | |
server { | |
listen 443; | |
server_name hostname; | |
root /usr/share/nginx/html; | |
ssl on; | |
ssl_certificate /etc/nginx/ssl/ssl.globalsign.com.pem; | |
ssl_certificate_key /etc/nginx/ssl/server.key; | |
ssl_protocols SSLv3 TLSv1.2; | |
ssl_ciphers HIGH:!aNULL:!MD5; | |
ssl_session_cache shared:SSL:120m; | |
ssl_session_timeout 5m; | |
# prefixがregister, mypage, login, logout で始まるパスの場合 | |
location ~ ^/(register|mypage|login|logout) { | |
# Basic認証設定 | |
auth_basic "Restricted"; | |
auth_basic_user_file /etc/nginx/.htpasswd; | |
# proxy ドメイン127.0.0.1:9000設定 | |
proxy_pass http://127.0.0.1:9000; | |
} | |
# 上記以外はhttp通信する様、リダイレクト | |
location / { | |
return 301 http://127.0.0.1$request_uri; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment