0
訪問者が以下のコードを使用してhttpからhttpsにアクセスすると、リダイレクトするように設定しました。nginxで特定のファイルをリダイレクトしない方法は?
server {
listen 80;
ssl off;
server_name seoartgallery.com www.seoartgallery.com ja.seoartgallery.com www.ja.seoartgallery.com;
root /var/www/seoart;
location =/example.txt {
# do stuff
}
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name seoartgallery.com ja.seoartgallery.com www.seoartgallery.com www.ja.seoartgallery.com;
root /var/www/seoart;
index index.php;
ssl_certificate /etc/letsencrypt/live/seoartgallery.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/seoartgallery.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/seoartgallery.com/chain.pem;
ssl_dhparam /etc/letsencrypt/live/seoartgallery.com/seoartgallery.com.dhparam;
ssl_stapling on;
ssl_stapling_verify on;
resolver 8.8.8.8 8.8.4.4;
# Enable HSTS. This forces SSL on clients that respect it, most
# modern browsers. The includeSubDomains flag is optional.
add_header Strict-Transport-Security "max-age=31536000";
# Set caches, protocols, and accepted ciphers. This config will
# merit an A+ SSL Labs score.
ssl_session_cache shared:SSL:20m;
ssl_session_timeout 10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
error_log /var/log/nginx/seoart.error.log warn;
location/{
try_files $uri $uri/ /index.php?$args;
}
# Allow Lets Encrypt Domain Validation Program
location ^~ /.well-known/acme-challenge/ {
allow all;
}
# Add a slash at the end of request */wp-admin
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
# Deny files starting with a . (dot)
location ~ /\. {
deny all;
}
location ~ /.well-known {
allow all;
}
# Add Rocket-Nginx configuration (of course !!)
include common/yoast.conf;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
しかし、私は1つのファイルだけをhttpsにリダイレクトしなかった。 例)http://example.com/example.txt
しかし、私はどのようにiその
は私が私が
は、以下のような
こんにちは。 お返事ありがとうございます。 しかし、私の仕事はありませんでした。 exmaple.txtファイルはまだhttps:// にリダイレクトされます。 私はそれを修正する方法を教えてください。ありがとうございます – Seomari
ブラウザの履歴を消去するか、シークレットモードを使用してみてください。 –
お返事ありがとうございます。まだ動作しません。私のフルコードをもう一度チェックしますか? – Seomari