質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
nginx

nginixは軽量で高性能なwebサーバーの1つです。BSD-likeライセンスのもとリリースされており、あわせてHTTPサーバ、リバースプロキシ、メールプロキシの機能も備えています。MacOSX、Windows、Linux、上で動作します。

SSL

SSL(Secure Sockets Layer)とは、暗号化されたプロトコルで、インターネット上での通信セキュリティを提供しています。

Q&A

解決済

1回答

3277閲覧

1台の専用サーバで複数IPアドレスに対してSSL "SNI" を対応する方法についてご教授ください

marshmallowy

総合スコア204

nginx

nginixは軽量で高性能なwebサーバーの1つです。BSD-likeライセンスのもとリリースされており、あわせてHTTPサーバ、リバースプロキシ、メールプロキシの機能も備えています。MacOSX、Windows、Linux、上で動作します。

SSL

SSL(Secure Sockets Layer)とは、暗号化されたプロトコルで、インターネット上での通信セキュリティを提供しています。

0グッド

0クリップ

投稿2016/04/05 12:27

###前提・実現したいこと
専用サーバを1台契約して複数IPアドレスを追加いたしました。
そして、運用するサイト毎にIPアドレスを振り分けて、NginxでSSLの設定をしたのですが、リダイレクトされます。

ご教授の程、よろしくお願いいたします。

###発生している問題・エラーメッセージ

###ソースコード

server {
listen 153.120.154.217:443 ssl;
server_name www.fascinate.click;

ssl_certificate /usr/local/nginx/ssl/crt/fascinate.crt; ssl_certificate_key /usr/local/nginx/ssl/key/fascinate.key; ssl_session_timeout 1d; ssl_session_cache shared:SSL:50m; ssl_session_tickets off; # intermediate configuration. tweak to your needs. ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS'; ssl_prefer_server_ciphers on; # HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months) add_header Strict-Transport-Security max-age=15768000; #ssl_stapling on; #ssl_stapling_verify on; #ssl_trusted_certificate /usr/local/nginx/ssl/crt/fascinate.crt; #resolver 153.120.154.217; ssl_buffer_size 4k; root /var/www/html/fascinate; access_log /usr/local/nginx/logs/ssl_fascinate_access.log; error_log /usr/local/nginx/logs/ssl_fascinate_error.log notice; rewrite_log on; location / { if ($server_name = fascinate.click) { rewrite (.*) https://www.fascinate.click$1; } index index.html index.php; ## If missing pass the URI to Magento's front handler try_files $uri $uri/ @handler; expires max; ## Enable max file cache } ## These locations need to be denied location ^~ /app/ { deny all; } location ^~ /includes/ { deny all; } location ^~ /lib/ { deny all; } location ^~ /media/downloadable/ { deny all; } location ^~ /pkginfo/ { deny all; } location ^~ /report/config.xml { deny all; } location ^~ /var/ { deny all; } ## Allow admins only to view export directory ## Set up the password for any username using this command: ## htpasswd -c /etc/nginx/htpasswd magentoadmin location /var/export/ { auth_basic "Restricted"; auth_basic_user_file htpasswd; ## Defined at /etc/nginx/htpassword } ## Disable .htaccess and other hidden files location /. { return 404; } ## Magento uses a common front handler location @handler { rewrite / /index.php; } location = / { set $first_language $http_accept_language; set $language_suffix 'english'; if ($first_language ~* 'ja') { set $language_suffix 'japanese'; } return $scheme://$host/$language_suffix/$1; } ## Forward paths like /js/index.php/x.js to relevant handler location ~ .php/ { rewrite ^(.*.php)/ $1 last; } ## php-fpm parsing location ~ .php$ { ## Catch 404s that try_files miss if (!-e $request_filename) { rewrite / /index.php last; } ## Old url of modify the processes #include /usr/local/nginx/conf/redirect/fascinate-redirect.conf; ## Disable cache for php files expires off; ## php-fpm configuration fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include /usr/local/nginx/conf/fastcgi_params; ## Tweak fastcgi buffers, just in case. fastcgi_buffer_size 128k; fastcgi_buffers 256 4k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; } #include /usr/local/nginx/conf/redirect/fascinate-rewrite-path.conf;

}

server {
listen 80;
server_name www.fascinate.click;
return 301 https://www.fascinate.click$request_uri;

#location ~ .php$ { ## Old url of modify the processes #include /usr/local/nginx/conf/redirect/fascinate-redirect.conf; #} #include /usr/local/nginx/conf/redirect/fascinate-rewrite-path.conf;

}

==============================================================================================

server {
listen 153.120.154.218:443 ssl;
server_name www.ks-clothing.click;

ssl_certificate /usr/local/nginx/ssl/crt/ksclothing.crt; ssl_certificate_key /usr/local/nginx/ssl/key/ksclothing.key; ssl_session_timeout 1d; ssl_session_cache shared:SSL:50m; ssl_session_tickets off; # intermediate configuration. tweak to your needs. ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS'; ssl_prefer_server_ciphers on; # HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months) add_header Strict-Transport-Security max-age=15768000; #ssl_stapling on; #ssl_stapling_verify on; #ssl_trusted_certificate /usr/local/nginx/ssl/crt/ksclothing.crt; #resolver 153.120.154.218; ssl_buffer_size 4k; root /var/www/html/fascinate; access_log /usr/local/nginx/logs/ssl_ksclothing_access.log; error_log /usr/local/nginx/logs/ssl_ksclothing_error.log notice; rewrite_log on; location / { if ($server_name = ks-clothing.click) { rewrite (.*) https://www.ks-clothing.click$1; } index index.html index.php; ## If missing pass the URI to Magento's front handler try_files $uri $uri/ @handler; expires max; ## Enable max file cache } ## These locations need to be denied location ^~ /app/ { deny all; } location ^~ /includes/ { deny all; } location ^~ /lib/ { deny all; } location ^~ /media/downloadable/ { deny all; } location ^~ /pkginfo/ { deny all; } location ^~ /report/config.xml { deny all; } location ^~ /var/ { deny all; } ## Allow admins only to view export directory ## Set up the password for any username using this command: ## htpasswd -c /etc/nginx/htpasswd magentoadmin location /var/export/ { auth_basic "Restricted"; auth_basic_user_file htpasswd; ## Defined at /etc/nginx/htpassword } ## Disable .htaccess and other hidden files location /. { return 404; } ## Magento uses a common front handler location @handler { rewrite / /index.php; } location = / { set $first_language $http_accept_language; set $language_suffix 'en'; if ($first_language ~* 'ja') { set $language_suffix 'japanese'; } if ($first_language ~* 'zh') { set $language_suffix 'cn'; } return $scheme://$host/$language_suffix/$1; } ## Forward paths like /js/index.php/x.js to relevant handler location ~ .php/ { rewrite ^(.*.php)/ $1 last; } ## php-fpm parsing location ~ .php$ { ## Catch 404s that try_files miss if (!-e $request_filename) { rewrite / /index.php last; } ## Old url of modify the processes #include /usr/local/nginx/conf/redirect/fascinate-redirect.conf; ## Disable cache for php files expires off; ## php-fpm configuration fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include /usr/local/nginx/conf/fastcgi_params; ## Tweak fastcgi buffers, just in case. fastcgi_buffer_size 128k; fastcgi_buffers 256 4k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; } #include /usr/local/nginx/conf/redirect/fascinate-rewrite-path.conf;

}

server {
listen 80;
server_name www.ks-clothing.click;
return 301 https://www.ks-clothing.click$request_uri;

#location ~ .php$ { ## Old url of modify the processes #include /usr/local/nginx/conf/redirect/fascinate-redirect.conf; #} #include /usr/local/nginx/conf/redirect/fascinate-rewrite-path.conf;

}

###補足情報(言語/FW/ツール等のバージョンなど)
OS: CentOS
Web Server: nginx-1.9.13
言語: PHP 5.5.33 (cli), PHP 5.5.33 (fpm-fcgi)

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

サイトごとに異なる IPアドレスならば SNI ではなく、IPベースのバーチャルホストですよね?

設定は問題ないと思います。
具体的にどの URL にアクセスして、応答コード、Location ヘッダに何が返るのでしょうか。

投稿2016/04/05 16:14

TaichiYanagiya

総合スコア12141

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

marshmallowy

2016/04/07 04:37

ありがとうございました。 設定内容を確認したところ、 root の記述に誤りがありました。
TaichiYanagiya

2016/04/07 04:47

root が同じだったのですね。 気づきませんでした。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問