VPS侦探论坛
标题:
请问怎么让所有的http自动变成https
[打印本页]
作者:
ads321
时间:
2018-1-3 12:49
标题:
请问怎么让所有的http自动变成https
请问怎么让所有的http自动变成https
作者:
evpin
时间:
2018-1-3 18:21
配置文件里用301 跳转
作者:
licess
时间:
2018-1-3 19:20
https://lnmp.org/faq/lnmp-nginx-301-rewrite.html
作者:
ads321
时间:
2018-1-4 10:26
标题:
回复 3# 的帖子
收到。。上次就看你给别人这个教程。。我试一试。
作者:
ads321
时间:
2018-1-4 13:35
标题:
回复 3# 的帖子
我按照那个方法。。所有位置都弄了。不能301重定向
server
{
listen 80;
#listen [::]:80;
server_name www.7shb.com 7shb.com ;
index index.html index.htm index.php default.html default.htm default.php;
root /7shb;
include other.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include enable-php.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log /home/wwwlogs/www.7shb.com.log;
}
server
{
listen 443 ssl http2;
#listen [::]:443 ssl http2;
server_name www.7shb.com wwww.7shb.com 7shb.com;
index index.html index.htm index.php default.html default.htm default.php;
root /7shb;
ssl on;
ssl_certificate /home/wwwroot/www.7shb.com/apache/www.7shb.com.crt;
ssl_certificate_key /home/wwwroot/www.7shb.com/apache/www.7shb.com.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+CHACHA20:EEC3DES:RSA+3DES:!MD5";这里隐藏一下。
ssl_session_cache builtin:1000 shared:SSL:10m;
# openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;
include other.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include enable-php.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log /home/wwwlogs/www.7shb.com.log;
}
server {
listen 80;
server_name www.7shb.com;
return 301 https://www.7shb.com$request_uri;
}
欢迎光临 VPS侦探论坛 (https://bbs.lnmp.com/)
Powered by Discuz! X3.4