1台の専用サーバで複数IPアドレスに対してSSL "SNI" を対応する方法についてご教授ください
解決済
回答 1
投稿
- 評価
- クリップ 0
- VIEW 1,932
前提・実現したいこと
専用サーバを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)
-
気になる質問をクリップする
クリップした質問は、後からいつでもマイページで確認できます。
またクリップした質問に回答があった際、通知やメールを受け取ることができます。
クリップを取り消します
-
良い質問の評価を上げる
以下のような質問は評価を上げましょう
- 質問内容が明確
- 自分も答えを知りたい
- 質問者以外のユーザにも役立つ
評価が高い質問は、TOPページの「注目」タブのフィードに表示されやすくなります。
質問の評価を上げたことを取り消します
-
評価を下げられる数の上限に達しました
評価を下げることができません
- 1日5回まで評価を下げられます
- 1日に1ユーザに対して2回まで評価を下げられます
質問の評価を下げる
teratailでは下記のような質問を「具体的に困っていることがない質問」、「サイトポリシーに違反する質問」と定義し、推奨していません。
- プログラミングに関係のない質問
- やってほしいことだけを記載した丸投げの質問
- 問題・課題が含まれていない質問
- 意図的に内容が抹消された質問
- 過去に投稿した質問と同じ内容の質問
- 広告と受け取られるような投稿
評価が下がると、TOPページの「アクティブ」「注目」タブのフィードに表示されにくくなります。
質問の評価を下げたことを取り消します
この機能は開放されていません
評価を下げる条件を満たしてません
質問の評価を下げる機能の利用条件
この機能を利用するためには、以下の事項を行う必要があります。
- 質問回答など一定の行動
-
メールアドレスの認証
メールアドレスの認証
-
質問評価に関するヘルプページの閲覧
質問評価に関するヘルプページの閲覧
checkベストアンサー
0
サイトごとに異なる IPアドレスならば SNI ではなく、IPベースのバーチャルホストですよね?
設定は問題ないと思います。
具体的にどの URL にアクセスして、応答コード、Location ヘッダに何が返るのでしょうか。
投稿
-
回答の評価を上げる
以下のような回答は評価を上げましょう
- 正しい回答
- わかりやすい回答
- ためになる回答
評価が高い回答ほどページの上位に表示されます。
-
回答の評価を下げる
下記のような回答は推奨されていません。
- 間違っている回答
- 質問の回答になっていない投稿
- スパムや攻撃的な表現を用いた投稿
評価を下げる際はその理由を明確に伝え、適切な回答に修正してもらいましょう。
15分調べてもわからないことは、teratailで質問しよう!
- ただいまの回答率 88.37%
- 質問をまとめることで、思考を整理して素早く解決
- テンプレート機能で、簡単に質問をまとめられる
2016/04/07 13:37
設定内容を確認したところ、 root の記述に誤りがありました。
2016/04/07 13:47
気づきませんでした。