全球主机交流论坛
标题:
lnmp 怎么弄全站走https
[打印本页]
作者:
风在吹屌在飞
时间:
2016-10-3 14:42
标题:
lnmp 怎么弄全站走https
全部资源都要走https,一个个替换好麻烦,好像可以可以用nginx的重写替换,具体怎么操作求大神指导
作者:
poropro
时间:
2016-10-3 14:49
百度一下你就知道
作者:
mjever
时间:
2016-10-3 14:57
google一下,你知道的更多
作者:
我是大傻瓜
时间:
2016-10-3 15:02
server
{
listen 80;
server_name hostname.com;
rewrite ^(.*) https://$server_name$1 permanent;
}
作者:
suzizi
时间:
2016-10-3 15:02
提示:
作者被禁止或删除 内容自动屏蔽
作者:
DeepSkyFire
时间:
2016-10-3 15:03
最好不要使用重寫跳轉的方式來對所有資源進行重定向到HTTPS。最好還是在模版內使用通用的格式來調用資源比如./或者./image/xxx.jpg這樣。當然實在覺得麻煩你可以配合nginx的URLrewrite替換插件來對http進行替換。
作者:
flyfish
时间:
2016-10-3 17:34
这是我的一个站的,xxx.com改成你自己的。
server
{
listen 80;
#listen [::]:80;
listen 443 ssl;
ssl on;
ssl_certificate /home/wwwroot/xxx.com.cert.crt;
ssl_certificate_key /home/wwwroot/xxx.com.key;
server_name xxx.com;
if ($server_port = 80) {
return 301 https://$server_name$request_uri;
}
if ($scheme = http) {
return 301 https://$server_name$request_uri;
}
error_page 497 https://$server_name$request_uri;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/xxx.com;
include none.conf;
#error_page 404 /404.html;
include enable-php.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /\.
{
deny all;
}
access_log /home/wwwlogs/xxx.com.log;
}
复制代码
作者:
zhong00123
时间:
2016-10-3 17:39
server
{
listen 80;
server_name lnmp.org www.lnmp.org;
return 301 https://lnmp.org$request_uri;
}
复制代码
军哥给的sample建议是用301
欢迎光临 全球主机交流论坛 (https://sunk.eu.org/)
Powered by Discuz! X3.4