nginx https ssl 配置
#设置https 访问
server {
listen ;
server_name www.xxx.com;
access_log xxx/xxx/xxx.log combined;
index index.html index.htm index.php;
include /etc/nginx/default.d/*.conf;
root /xxx/xxx/xxx/www.xxx.com; ssl on;
ssl_certificate /usr/local/nginx/conf/ssl/server.pem;
ssl_certificate_key /usr/local/nginx/conf/ssl/server.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDH:AESGCM:HIGH:!RC4:!DH:!MD5:!aNULL:!eNULL;
ssl_prefer_server_ciphers on; location ~ [^/]\.php(/|$) {
#fastcgi_pass remote_php_ip:9000;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
}
将http请求强制转换为https
server {
listen ;
server_name www.xxx.com;
access_log xxx/xxx/xxx.log combined;
index index.html index.htm index.php;
include /etc/nginx/default.d/*.conf;
rewrite ^(.*) https://$server_name$1 permanent;
location ~ [^/]\.php(/|$) {
#fastcgi_pass remote_php_ip:9000;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
}
证书需要购买,淘宝便宜;
nginx https ssl 配置的更多相关文章
- nginx https ssl 设置受信任证书[转然哥]
nginx https ssl 设置受信任证书[原创] 1. 安装nginx 支持ssl模块 http://nginx.org/en/docs/configure.html yum -y instal ...
- Tomcat服务器配置https协议(Tomcat HTTPS/SSL 配置)
通常商用服务器使用https协议需要申请SSL证书,证书都是收费的,价格有贵的有便宜的.它们的区别是发行证书的机构不同,贵的证书机构更权威,证书被浏览器否决的几率更小. 非商业版本可以通过keytoo ...
- Sahi (2) —— https/SSL配置(102 Tutorial)
Sahi (2) -- https/SSL配置(102 Tutorial) jvm版本: 1.8.0_65 sahi版本: Sahi Pro 6.1.0 参考来源: Sahi官网 Sahi Quick ...
- nginx配置ssl双向验证 nginx https ssl证书配置
1.安装nginx 参考<nginx安装>:http://www.ttlsa.com/nginx/nginx-install-on-linux/ 如果你想在单IP/服务器上配置多个http ...
- Nginx+HTTPS(SSL/TLS)
环境 首先确保机器上安装了openssl和openssl-devel rpm -qa | grep openssl #yum install openssl #yum install openssl- ...
- nginx https ssl 设置受信任证书[原创]
1. 安装nginx 支持ssl模块 http://nginx.org/en/docs/configure.html yum -y install openssh openssh-devel (htt ...
- Nginx httpS server配置
Nginx httpS 配置 配置同时支持http和httpS协议: server { listen ; #backlog:每个网络接口接收数据包的速率比内核处理这些包的速率快时,允许送到队列的数据包 ...
- CentOS 6.5 nginx+tomcat+ssl配置
本文档用于指导在CentOS 6.5下使用nginx反向代理tomcat,并在nginx端支持ssl. 安装nginx.参见CentOS 6 nginx安装. SSL证书申请.参见腾讯SSL证书申请和 ...
- Nginx, HTTPS的配置
server {listen 443; ####HTTPS指定端口server_name www.web.com; #####域名或者IP root /data/wwwroot/l ...
随机推荐
- 20165322 预备作业3 Linux安装及学习
Linux安装及学习 安装部分 由于是第一次接触虚拟机知识,之前也没什么了解,我选择完全按照老师教程里的安装vbox虚拟机. 虚拟机安装的过程很顺利,不做详细讲解. 出现的问题 在启动我新建的虚拟电脑 ...
- win10的host设置
路径:C:\Windows\System32\drivers\etc\hosts 例如: 127.0.0.1 localhost 10.201.3.177 apmdbm1
- Hangfire 在asp.net core环境的使用
hf被定义为分布式后台服务,更加类似job作业的服务做作业的插件有quartz.net,JobScheduler 等当然,都有一些分别和适用的场景.1.安装需要安装Hangfire.CoreHangf ...
- Android学习笔记_16_添加多个Activity、参数传递、请求码和结果码使用
一.添加新的Activity步骤: 第一步:新建一个继承Activity的类,如:NewActivity public class NewActivity extends Activity { @Ov ...
- js两个浮点数相减出现多位小数的bug
- js获取站点根目录
function getRootPath(){ var strFullPath=window.document.location.href; var strPath=win ...
- 用c#语言编写水仙花数
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threa ...
- Restframework中常见API的编写方式
1.框架一(继承APIView) 这里的第一部分使用骨架请参考我的博客(第三篇),它采用了restframework中最基础的办法(APIView)实现了相关请求,以下的框架都是基于它的 2.框架二( ...
- Python 学习笔记(八)Python列表(三)
序列 序列:数学上,序列是被排成一列的对象(或事件):这样,每个元素不是在器他元素之前,就是在其他元素之后.这里元素之间的顺序非常重要.<维基百科> 序列是Python中最基本的数据结构. ...
- iOS之查看代码运行的时间
有时候我们想要准确的知道某段代码.某个循环执行的时间,然后分析效率等问题,这个时候就需要执行时间是多少.正好看到网上已经有人做了这个工作,我就直接摘下来了.正好也用了宏的方式计算时间,我们只要在需要计 ...