80端口怎么自动跳转到443端口?
配置文件如下:请问怎么输入http自动跳转到https呢?有ssl证书的了.
server
{
listen 443;
#listen [::]:80;
server_name www.domain.com;
index index.html index.htm index.php default.html default.htm default.php;
root/mnt/data1/www/www. domain.com;
include none.conf;
#error_page 404 /404.html;
ssl on;
ssl_certificate /usr/local/nginx/certs/server2.crt;
ssl_certificate_key /usr/local/nginx/certs/server2.key;
location ~ [^/]\.php(/|$)
{
# comment try_files $uri =404; to enable pathinfo
try_files $uri =404;
fastcgi_passunix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_param HTTPS on;
#include pathinfo.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log/home/wwwlogs/www. domain.com.logaccess;
} 301过去就行了
server {
listen 80;
server_namewww.domain.com;
return 301 https://www.domain.com$request_uri;
}
页:
[1]