您好,我创建了一个新的虚拟主机,但是http可以在所有浏览器中重定向到https。 操作系统16.04 下面的Nginx nginx / 1.10.3是我的主机文件
`服务器
{ 监听80 default_server;
收听[::]:80 default_server;
server_name local.com;
access_log /var/log/nginx/local.com_access.log;
error_log /var/log/nginx/local.com_error.log;
#ssl off;
root /var/www/test;
location / {
index index.php;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-Host $host;
try_files $uri $uri/ @handler;
}
# serve static files directly
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
access_log off;
expires 30d;
}
location @handler { ## Magento uses a common front handler
rewrite / /index.php;
}
location ~ \.php$ {
if (!-e $request_filename) { rewrite / /index.php last; } ## Catch 404s that try_files miss
add_header Strict-Transport-Security max-age=0;
fastcgi_intercept_errors on;
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;
fastcgi_read_timeout 180;
include fastcgi_params;
}
}
`