Skip to content

Instantly share code, notes, and snippets.

@t-oginogin
Created April 22, 2014 08:58
Show Gist options
  • Select an option

  • Save t-oginogin/11170871 to your computer and use it in GitHub Desktop.

Select an option

Save t-oginogin/11170871 to your computer and use it in GitHub Desktop.
Nginxで同じサーバーに複数のIP address用の証明書を配置する ref: http://qiita.com/t_oginogin/items/c6a95a9d61424141dff3
local address:xxx.xxx.xxx.xxx
global address:yyy.yyy.yyy.yyy
/etc/nginx/ssl_certfile/key_yyy_yyy_yyy_yyy/server_pem.crt
/etc/nginx/ssl_certfile/key_yyy_yyy_yyy_yyy/server_pem.key
/etc/nginx/ssl_certfile/key_xxx_xxx_xxx_xxx/server_pem.crt
/etc/nginx/ssl_certfile/key_xxx_xxx_xxx_xxx/server_pem.key
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;
}
net.ipv4.ip_nonlocal_bind = 1
$ sysctl -p /etc/sysctl.conf
$ 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