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请求的步骤和自己遇到的一些问题。 环境说明 因为我的网站是部署在腾讯...
- 给nginx配置SSL证书后(这里使用的是自己生成的测试证书,参见 nginx使用ssl模块配置HTTPS支持),...
- 操作步骤 1.登录阿里云SSL证书控制台。 2.在SSL证书页面,单击已签发标签,定位到需要下载的证书并单击证书卡...
- 一、阿里云平台购买证书,步骤参见阿里云SSL购买教程。 二、认证成功后下载证书 三、将下载好的证书部署到服务器 根...