我有这个 nginx 配置:
worker_processes 1;
error_log /home/paolino/error.log notice;
events {worker_connections 1024;}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 443 ssl;
server_name lambdasistemi.net;
ssl_certificate /home/paolino/lambdasistemi.net.crt;
ssl_certificate_key /home/paolino/lambdasistemi.net.key;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
location /reactivegas/ {
include scgi_params;
scgi_pass localhost:8000;
}
location /static {
return 301 http://lambdasistemi.net$request_uri;
}
}
server {
listen 80;
location /reactivegas/ {
return 301 https://lambdasistemi.net/reactivegas;
}
location /static {
root /var/http;
}
}
upstream php {
server unix:/var/run/php-fpm/php-fpm.sock;
}
include /etc/nginx/sites-enabled/*;
}
http://lambdasistemi.net/reactivegas在 Firefox 上有效,但在 Chrome 上出现 404。 https://lambdasistemi.net/reactivegas在 Firefox 上有效,但在 Chrome 上,重定向到 http 的链接无法加载。
是 Chrome 不尊重 301 还是我使用了不兼容的方法?
谢谢
保利诺
答案1
当你输入 /reactivegas/ 时,它在 chrome 上运行良好 - 所以问题很简单:
location /reactivegas/ {
return 301 https://lambdasistemi.net/reactivegas;
}
将其编辑为:
location /reactivegas {
return 301 https://lambdasistemi.net/reactivegas;
}
它应该可以工作。