nginx增加ssl服务方法
1.将申请到的ssl加密证书文件拷贝到nginx的conf目录下
如:server.pem、server.key
2.vim nginx.conf
例子:
server {
listen 443 ssl;
#listen 80;
server_name www.test.com;
ssl_certificate server.pem;
ssl_certificate_key server.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers RC4:HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
root /mnt/html/test;
index index.php index.html index.htm;
access_log logs/test.com_access.log;
error_log logs/test.com_error.log debug;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /mnt/html;
}
#重定向
location / {
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
}
}
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
3.配置http重定向到https
server {
listen 80;
server_name www.test.com test.com;
rewrite ^(.*)$ https://www.test.com$1 permanent;
}
4.重启nginx 搞定
nginx增加ssl服务方法的更多相关文章
- nginx增加ssl支持 - 编译时参数详情列表
./configure \ --with-http_ssl_module \ make && make install nginx编译参数说明如下: --prefix=&l ...
- Nginx配置SSL自签名证书
生成自签名SSL证书 生成RSA密钥(过程需要设置一个密码,记住这个密码) $ openssl genrsa -des3 -out domain.key 1024 拷贝一个不需要输入密码的密钥文件 $ ...
- LNMP安装Let’s Encrypt 免费SSL证书方法:自动安装与手动配置Nginx
前几天介绍了最新StartSSL免费SSL申请与配置,很多人看到部落介绍SSL证书安装时总是推荐了OneinStack,因为OneinStack提供了一键添加和配置Let's Encrypt 免费SS ...
- nginx配置SSL证书实现https服务
在前面一篇文章中,使用openssl生成了免费证书 后,我们现在使用该证书来实现我们本地node服务的https服务需求.假如我现在node基本架构如下: |----项目 | |--- static ...
- Nginx 安装成Windows 服务方法
1. 下载nginx windows版本 http://www.nginx.org 2. 下载微软的2个工具: instsrv.exe.srvany.exe 去微软网站下载安装Windows Serv ...
- nginx配置ssl证书的方法
Nginx (读音"engine x") 是一个高性能的HTTP和反向代理服务器,比Apache占用更少的内存,同时也像Apache一样支持HTTPS方式访问(SSL加密).本教程 ...
- 用 nssm 把 Nginx 安装成 Windows 服务方法
总之:用 nssm 比 srvany.exe 简便多了.1. 下载nginx windows版本:http://nginx.org/ 2. 下载 nssm :http://nssm.cc/3. 安装N ...
- nginx安装ssl
http://wiki.nginx.org/Modules#Standard_HTTP_modules 这里面带有所有基本的模块,及需要额外增加的模块 1.安装带有ssl模块的 nginx wget ...
- Nginx、SSL双向认证、PHP、SOAP、Webservice、https
本文是1:1模式,N:1模式请参见新的一篇博客<SSL双向认证(高清版)> ----------------------------------------------------- 我是 ...
随机推荐
- Metropolis Light Transport学习与实现
这段时间一直在看Metropolis Light Transport(简称mlt),现利用这篇博文把之前看资料已经coding上的一些体会记录下来. 1.Before MLT 在MLT算法被提出之前, ...
- 安装hadoop2.4.0遇到的问题
一.执行start-dfs.sh后,datenode没有启动 查看日志如下: 2014-06-18 20:34:59,622 FATAL org.apache.hadoop.hdfs.server.d ...
- block中防止循环引用的一个高大上的宏定义
看惯了什么tempSelf weakSelf,来点高大的 #define weakify(...) \ rac_keywordify \ metamacro_foreach_cxt(rac_weaki ...
- 复选框全选、全不选和反选的效果实现VIEW:1592
<html> <head> <meta http-equiv="Content-Type" content="text/html; char ...
- TCP和UDP的保护消息边界机制
在socket网络程序中,TCP和UDP分别是面向连接和非面向连接的.TCP的socket编程,收发两端都要有一一成对的socket,因此,发送端为了将多个发往接收端的包,更有效的发到对方,使用了优化 ...
- Cannot find class [org.apache.commons.dbcp.BasicDataSource]
错误:Cannot find class [org.apache.commons.dbcp.BasicDataSource] 原因:缺少commons-dbcp.jar
- ajax原理,验证码生成原理
什么是ajax AJAX:”Asynchronous JavaScript and XML” 中文意思:异步JavaScript和XML 指一种创建交互式网页应用的网页开发技术. 不是指一种单一的 ...
- 导出Excel之Epplus使用教程2(样式设置)
导出Excel之Epplus使用教程1(基本介绍) 导出Excel之Epplus使用教程2(样式设置) 导出Excel之Epplus使用教程3(图表设置) 导出Excel之Epplus使用教程4(其他 ...
- kindle paperwhite折腾记
在亚马逊官网上买了一个kindle paperwhite 一代(849元) , 打算再买个皮套, 淘宝店 http://detail.tmall.com/item.htm?spm=a230r.1.1 ...
- POJ 2513 Colored Sticks
Colored Sticks Time Limit: 5000MS Memory Limit: 128000K Total Submissions: 28036 Accepted: 7428 ...