#设置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. 20165322 预备作业3 Linux安装及学习

    Linux安装及学习 安装部分 由于是第一次接触虚拟机知识,之前也没什么了解,我选择完全按照老师教程里的安装vbox虚拟机. 虚拟机安装的过程很顺利,不做详细讲解. 出现的问题 在启动我新建的虚拟电脑 ...

  2. POJ 3020 Antenna Placement 【最小边覆盖】

    传送门:http://poj.org/problem?id=3020 Antenna Placement Time Limit: 1000MS   Memory Limit: 65536K Total ...

  3. 【luogu P2661 信息传递】 题解

    题目链接:https://www.luogu.org/problemnew/show/P2661#sub 一种利用并查集求最小环的做法: 对于每个同学看作一个点,每次信息传递是一条有向边,当出现最小环 ...

  4. 【luogu P3372 线段树1】 模板

    线段树的模板题 题目链接:https://www.luogu.org/problemnew/show/P3372 update区间修改,query区间求和 #include <iostream& ...

  5. Android学习笔记_46_fragment的简单应用

    Fragments 诞生初衷 http://www.cnblogs.com/TerryBlog/archive/2012/02/17/2355753.html 自从Android 3.0中引入frag ...

  6. 【其它】Nook HD刷机

    很久以前的 Nook HD 平板刷机.只能用 microSD(TF)卡刷.需要的软件全都保存在了自己的百度网盘,自己亲测有效. 一.准备工作 1.首先,将tf卡格式化为fat32格式,实测可以使用.将 ...

  7. 金s办公软件web前端笔试题

    1. var arr = []; arr['a'] = 1; console.log(arr.length); // A arr['4'] = 2; console.log(arr.length); ...

  8. 常用的linux指令整理

    ls 列出文件目录 -a全部文件,连同隐藏文件一起列出 -d仅列出目录本身,而不是列出目录内的文件数据 -l 连同权限一同列出 cd 切换文件目录的命令 pwd显示目前所在的目录 mkdir 创建新的 ...

  9. 关于刷新同级layer弹框的解决方法

    在项目中遇到这种情况: 父页面点击详情,layer.open一个子页面A,子页面里面又存在操作按钮,点击使用parent.layer.open在打开一个子页面B,子页面B点击提交操作成功要刷新子页面A ...

  10. Element.getBoundingClientRect()

    Element.getBoundingClientRect()方法会返回元素的大小和相对于视口的位置 语法: var domRect = element.getBoundingClientRect() ...