Created
April 22, 2014 08:58
-
-
Save t-oginogin/11170871 to your computer and use it in GitHub Desktop.
Nginxで同じサーバーに複数のIP address用の証明書を配置する ref: http://qiita.com/t_oginogin/items/c6a95a9d61424141dff3
This file contains hidden or 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
| local address:xxx.xxx.xxx.xxx | |
| global address:yyy.yyy.yyy.yyy |
This file contains hidden or 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
| /etc/nginx/ssl_certfile/key_yyy_yyy_yyy_yyy/server_pem.crt | |
| /etc/nginx/ssl_certfile/key_yyy_yyy_yyy_yyy/server_pem.key |
This file contains hidden or 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
| /etc/nginx/ssl_certfile/key_xxx_xxx_xxx_xxx/server_pem.crt | |
| /etc/nginx/ssl_certfile/key_xxx_xxx_xxx_xxx/server_pem.key |
This file contains hidden or 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
| upstream sample_app { | |
| server unix:/var/www/sample_app/tmp/sockets/unicorn.sock; | |
| } | |
| server { | |
| listen yyy.yyy.yyy.yyy:443; | |
| server_name sample_app; | |
| ssl on; | |
| ssl_certificate /etc/nginx/ssl_certfile/key_yyy_yyy_yyy_yyy/server_pem.crt; | |
| ssl_certificate_key /etc/nginx/ssl_certfile/key_yyy_yyy_yyy_yyy/server_pem.key; | |
| ssl_protocols SSLv3 TLSv1; | |
| ssl_ciphers HIGH:!ADH:!MD5; | |
| location / { | |
| try_files $uri $uri/index.html $uri.html @sample_app; | |
| client_max_body_size 2M; | |
| } | |
| location @sample_app { | |
| proxy_read_timeout 30; | |
| proxy_connect_timeout 30; | |
| proxy_redirect off; | |
| proxy_set_header X-Forwarded-Proto https; | |
| proxy_set_header Host $http_host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_pass http://sample_app; | |
| proxy_send_timeout 30; | |
| } | |
| } | |
| server { | |
| listen xxx.xxx.xxx.xxx:443; | |
| server_name sample_app; | |
| ssl on; | |
| ssl_certificate /etc/nginx/ssl_certfile/key_xxx_xxx_xxx_xxx/server_pem.crt; | |
| ssl_certificate_key /etc/nginx/ssl_certfile/key_xxx_xxx_xxx_xxx/server_pem.key; | |
| ssl_protocols SSLv3 TLSv1; | |
| ssl_ciphers HIGH:!ADH:!MD5; | |
| location / { | |
| try_files $uri $uri/index.html $uri.html @sample_app; | |
| client_max_body_size 2M; | |
| } | |
| location @sample_app { | |
| proxy_read_timeout 30; | |
| proxy_connect_timeout 30; | |
| proxy_redirect off; | |
| proxy_set_header X-Forwarded-Proto https; | |
| proxy_set_header Host $http_host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_pass http://sample_app; | |
| proxy_send_timeout 30; | |
| } |
This file contains hidden or 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
| net.ipv4.ip_nonlocal_bind = 1 |
This file contains hidden or 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
| $ sysctl -p /etc/sysctl.conf |
This file contains hidden or 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
| $ sudo /sbin/service nginx start | |
| Starting nginx: [emerg]: bind() to yyy.yyy.yyy.yyy failed (99: Cannot assign requested address) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment