#设置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 配置的更多相关文章

  1. nginx https ssl 设置受信任证书[转然哥]

    nginx https ssl 设置受信任证书[原创] 1. 安装nginx 支持ssl模块 http://nginx.org/en/docs/configure.html yum -y instal ...

  2. Tomcat服务器配置https协议(Tomcat HTTPS/SSL 配置)

    通常商用服务器使用https协议需要申请SSL证书,证书都是收费的,价格有贵的有便宜的.它们的区别是发行证书的机构不同,贵的证书机构更权威,证书被浏览器否决的几率更小. 非商业版本可以通过keytoo ...

  3. 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 ...

  4. nginx配置ssl双向验证 nginx https ssl证书配置

    1.安装nginx 参考<nginx安装>:http://www.ttlsa.com/nginx/nginx-install-on-linux/ 如果你想在单IP/服务器上配置多个http ...

  5. Nginx+HTTPS(SSL/TLS)

    环境 首先确保机器上安装了openssl和openssl-devel rpm -qa | grep openssl #yum install openssl #yum install openssl- ...

  6. nginx https ssl 设置受信任证书[原创]

    1. 安装nginx 支持ssl模块 http://nginx.org/en/docs/configure.html yum -y install openssh openssh-devel (htt ...

  7. Nginx httpS server配置

    Nginx httpS 配置 配置同时支持http和httpS协议: server { listen ; #backlog:每个网络接口接收数据包的速率比内核处理这些包的速率快时,允许送到队列的数据包 ...

  8. CentOS 6.5 nginx+tomcat+ssl配置

    本文档用于指导在CentOS 6.5下使用nginx反向代理tomcat,并在nginx端支持ssl. 安装nginx.参见CentOS 6 nginx安装. SSL证书申请.参见腾讯SSL证书申请和 ...

  9. Nginx, HTTPS的配置

    server {listen 443;      ####HTTPS指定端口server_name www.web.com;      #####域名或者IP root /data/wwwroot/l ...

随机推荐

  1. django使用orm方式查询mogodb的某段时间的值

    在使用djgango时,需要在数据表中过滤出在某段时间的内容,网上很多或者说Django的orm是针对mysql,且字段类型是datetime或者其他时间类型,使用__rang这个函数就可以查询某个时 ...

  2. Python实现读取json文件到excel表

    一.需求 1.'score.json' 文件内容: { "1":["小花",99,100,98.5], "2":["小王" ...

  3. git使用过程的问题与解决办法

    一.什么是Git Git是目前世界上最先进的分布式版本控制系统.工作原理 / 流程: Workspace:工作区Index / Stage:暂存区Repository:仓库区(或本地仓库)Remote ...

  4. sql*plus

    [sql*plus创建txt文档编辑sql语句] (1)创建一个txt,命名doc SQL> ed  doc;          /*ed   文件名*/ (2)在doc.txt文件编辑sql语 ...

  5. 简明 ES6 模块

    简明 ES6 模块 1.什么是模块 模块就是一段代码,这段代码可以反复使用,经常单独写成一个文件,一旦加载会立即执行. 2.导出 导出有 2 种方式:命名导出和默认导出,分别用关键字export和ex ...

  6. NEC 框架规范 css reset

    /* reset */html,body,h1,h2,h3,h4,h5,h6,div,dl,dt,dd,ul,ol,li,p,blockquote,pre,hr,figure,table,captio ...

  7. window/linux下获取文件MD5

    MD5消息摘要算法(英语: MD5 Message-Digest Algorithm), 主要用于确保信息传输过程的一致性校验.   首先介绍两个工具: window: WinMD5Free Linu ...

  8. python 之函数

    一 函数的定义:对功能和动作的封装和定义.二 函数的格式:def 函数名(形参列表): 函数名就是变量名:规则就是变量的规则 函数体(return) ret = 函数名(实参列表)三 函数的返回值:函 ...

  9. mybatis <fireach> 拼接sql语句 org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: org.apache.ibatis.builder.BuilderException: Error evaluating expression 'in'. Cause:

    <select id="getUserIn" parameterType="QueryVo" resultMap="userMap"& ...

  10. mysql——查询重复数据,及删除重复数据只保留一条数据

    查询 text 表中,user_name字段值重复的数据及重复次数 select user_name,count(*) as count from text 删除 text 表中,重复出现的数据只保留 ...