3
https://example.comにトラフィックを送信します。 wwwプレフィックスはありませんとなります。SSLが必要です。NGINX HTTPSへのリダイレクトは、更新後にのみ動作します。
私たちが経験している問題は、リフレッシュするまで初めての多くの訪問者がHTTPSにリダイレクトされていないことです。
私の設定でこの動作を許可するものはありますか?
server {
listen 80;
listen 443 ssl;
server_name www.example.com;
return 301 https://example.com$request_uri;
}
server {
listen 80;
listen 443 ssl;
server_name example.com;
root /var/www/html/mm;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Port 443;
proxy_set_header Host $http_host;
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
client_max_body_size 200m;
location/{
try_files $uri $uri/ /index.php?$query_string;
index index.php index.html index.htm install.php;
client_max_body_size 200m;
}
location ~ \.php$ {
try_files $uri /index.php =404;
#fastcgi_pass unix:/var/run/php-fpm/www.sock;
fastcgi_pass php-fpm;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
fastcgi_param PHP_VALUE "upload_max_filesize = 150M \n upload_max_filesize=151M";
fastcgi_param PHP_VALUE "post_max_size = 150M \n post_max_size=151M";
include fastcgi_params;
}
HTTPをリダイレクトすることはありません - > https:人々が 'www.'なしで入る場合。リフレッシュ後は、HSTSヘッダーのために動作します。 – PeeHaa
最初のブロックでは、 'return 301 https://example.com$request_uri;'がリダイレクトです。 – Justin
はい、人が「*」と入力した場合です。 – PeeHaa