Nginx httpS server配置
Nginx httpS 配置
配置同时支持http和httpS协议:
server {
listen default backlog=;
#backlog:每个网络接口接收数据包的速率比内核处理这些包的速率快时,允许送到队列的数据包的最大数目。
listen ssl;
server_name ssl.joy4you.com;
ssl_certificate /data/nginx/conf/server.crt;
ssl_certificate_key /data/nginx/conf/server_nopwd.key;
root /data/;
location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?$args;
}
location ~ .*\.(php|php5)?$ {
# try_files $uri =;
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi.conf;
}
}
配置/data/http/使用http协议;/data/ssl/使用httpS协议:
server {
listen ;
server_name 192.168.17.16;
access_log /data/nginx/logs/php.joy4you.com.log main;
root /data/http/;
location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?$args;
}
location ~ .*\.(php|php5)?$ {
# try_files $uri =;
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi.conf;
}
}
server {
listen ;
ssl on;
ssl_certificate /data/nginx/conf/server.crt;
ssl_certificate_key /data/nginx/conf/server_nopwd.key;
server_name 192.168.17.16;
access_log /data/nginx/logs/php.joy4you.com.log main;
root /data/ssl/;
location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?$args;
}
location ~ .*\.(php|php5)?$ {
# try_files $uri =;
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi.conf;
}
}
把访问80端口的请求全部转发到443(https):
server {
listen ;
server_name 192.168.17.16;
rewrite ^(.*) https://$server_name$1 permanent;
}
server {
listen ;
ssl on;
ssl_certificate /data/nginx/conf/server.crt;
ssl_certificate_key /data/nginx/conf/server_nopwd.key;
server_name 192.168.17.16;
access_log /data/nginx/logs/php.joy4you.com.log main;
root /data/;
location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?$args;
}
location ~ .*\.(php|php5)?$ {
# try_files $uri =;
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi.conf;
}
}
使用沃通的CA证书,他们推荐的https配置:
server {
listen ;
server_name localhost;
#为一个server开启ssl支持
ssl on;
#为虚拟主机指定pem格式的证书文件
ssl_certificate /home/wangzhengyi/ssl/wangzhengyi.crt;
#为虚拟主机指定私钥文件
ssl_certificate_key /home/wangzhengyi/ssl/wangzhengyi_nopass.key;
#客户端能够重复使用存储在缓存中的会话参数时间
ssl_session_timeout 5m;
#指定使用的ssl协议
ssl_protocols TLSv1 TLSv1. TLSv1.;
#指定许可的密码描述
ssl_ciphers ALL:!ADH:!EXPORT56: -RC4+RSA:+HIGH:+MEDIUM: !EXP;
#ssl_ciphers ALL:!ADH:!EXPORT56: -RC4+RSA:+HIGH:+MEDIUM:-EXP;
#SSLv3和TLSv1协议的服务器密码需求优先级高于客户端密码
ssl_prefer_server_ciphers on;
SLL参数:
ssl_session_timeout 5m; ##设置客户端能够反复使用储存在缓存中的会话参数时间。
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ##指定要开启的SSL协议。
ssl_ciphers ALL:!ADH:!EXPORT56:-RC4+RSA:+HIGH:+MEDIUM:!EXP; ##指出为建立安全连接,服务器所允许的密码格式列表,密码指定为OpenSSL支持的格式
ssl_prefer_server_ciphers on; ##依赖SSLv3和TLSv1协议的服务器密码将优先于客户端密码.
Nginx httpS server配置的更多相关文章
- StartCom 申请 SSL 证书及 Nginx HTTPS 支持配置全攻略
来源:https://www.williamyao.com/index.php/archives/1397/ 前言 最近收到 StartCom 的邮件,数字证书即将过期,想到去年在 StartSSL ...
- nginx多server配置记录
直接在配置文件(/etc/nginx/nginx.conf)中添加如下代码: server { listen 8080; server_name 192.168.100.174:8080; root ...
- nginx https ssl 配置
#设置https 访问server { listen ; server_name www.xxx.com; access_log xxx/xxx/xxx.log combined; index ind ...
- nginx下面server配置
haomeiv配置 log_format www.haomeiv.com '$remote_addr - $remote_user [$time_local] "$request" ...
- Nginx, HTTPS的配置
server {listen 443; ####HTTPS指定端口server_name www.web.com; #####域名或者IP root /data/wwwroot/l ...
- Nginx一个server配置多个location(使用alias)
公司测试环境使用nginx部署多个前端项目.网上查到了两个办法: 在配置文件中增加多个location,每个location对应一个项目比如使用80端口,location / 访问官网: locati ...
- Nginx同server配置下配置多个localhost路由地址
nginx多页面路由配置,进入 nginx/conf/nginx.conf: http { ...... server { listen 80; server_name localhost; loca ...
- nginx https证书配置
1. Nginx配置 server { listen 443; #指定ssl监听端口 server_name www.example.com; ssl on; #开启ssl支持 ssl_certifi ...
- Nginx一个server配置多个location
在配置文件中增加多个location,每个location对应一个项目 比如使用8066端口,location / 访问官网: location /demo访问培训管理系统配置多个站点我选择了配置多个 ...
随机推荐
- Mongo, Express, Angular, Node-- MEAN Stack搭建
前言 作为一个从后端转全栈的码农,我一直使用express,jade & bootstrap, jquery的组合.重复了几次相同的工作后,看到网上开始流行MEAN Stack,于是也对其研究 ...
- VLAN虚拟局域网技术(一)-计算机网络
本文主要知识来源于学校课程,部分知识来自于H3C公司教材,未经许可,禁止转载.如需转载,请联系作者并注明出处. 1. VLAN(Virtual LAN):我们称之为虚拟局域网,它的作用就是将物理上互 ...
- 删除读取失败的服务 <读取描述失败错误代码2>
1.以管理员身份运行命令提示符 2.sc delete 服务名
- Java中Collections.sort()排序详解
public static void main(String[] args) { List<String> list = new ArrayList<String>(); ...
- 处理跨线程操作问题(使用Action和delegate或lambda表达式)
方法A: Action f = () => { txtProcess.Text = "开始更新程序.. ...
- neutron ovs+vxlan
title: Neutron ovs+vxlan date: 2017-04-26 23:37 tags: Network 主机网卡配置 controller: ens160:192.168.11.1 ...
- day4-不同目录间模块的调用
1.前言 上文已经讲述了软件项目开发目录规范的若干事项,现在问题来了,我们遵循了项目目录设计规范,不同目录下设计了不同的函数和模块,怎么实现对这些模块的调用,使其为项目整体所用呢?本章节讲述的绝对路径 ...
- ARM的编程模式和7种模式
ARM采用的是32位架构 ARM阅读 --Byte: 8 bits --Halfword: 16 bits(2 byte) 半字 --Word: 32 bits( ...
- 遍历输出所有子视图(View)
传入一个View,可以获取传入视图的所有子视图,写入桌面,可以在火狐浏览器下查看 /** * 程序获得了焦点就会自动调用这个方法(只要程序获得了焦点,所有控件才能接收触摸事件) */ - (void) ...
- 热烈祝贺博主LZUGIS博客访问量突破
截止发文时间,博主"LZUGIS"CSDN博客文章总访问量突破50W,值此特殊的时刻,特发此文,以表纪念与督促. 博客详情 博客专栏 公众号 常言道:不积跬步,无以至千里:不积小流 ...