Nginx配置实现https和http共存
作者:
geeooooz | 来源:发表于
2022-09-30 10:13 被阅读0次 server {
listen 80;
server_name xxx.xxx.com;
index index.html index.htm index.php;
root /www/zhongchou;//项目存放地址
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
location ~* .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
access_log off;
}
location ~* .*\.(js|css)?$ {
expires 1d;
access_log off;
}
}
server {
listen 443;
server_name xxx.xxx.com;
index index.html index.htm index.php;
root /www/zhongchou;
ssl on;
ssl_certificate /data/conf/nginx-1.8.0/cert/zhongchou/6364632_zhongchou.zgrllm.com.pem;
ssl_certificate_key /data/conf/nginx-1.8.0/cert/zhongchou/6364632_zhongchou.zgrllm.com.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
access_log off;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
location ~* .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
access_log off;
}
location ~* .*\.(js|css)?$ {
expires 1d;
access_log off;
}
}
本文标题:Nginx配置实现https和http共存
本文链接:https://www.haomeiwen.com/subject/koplartx.html
网友评论