配置NGINX同时运行 https 和 http
2016-12-23 11:57
871 查看
为配合APP STORE 要求HTTPS来访问请求,所以需要改造网站HTTP和HTTPS都能访问。
备注:SSL 是需要申请证书的,key和PEM文件要放到服务器路径。【我申请的是赛门铁克的】
然后NGINX下要进行443端口和80端口的绑定。
server {
listen 80;
server_name ietaiji.com www.ietaiji.com;
root "D:/aaa/WWW/ietaiji";
index index.html index.htm index.php;
location ~ \.php$ {
charset gb2312;
try_files $uri =404;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
server {
listen 443;
server_name ietaiji.com www.ietaiji.com;
ssl on;
ssl_certificate C:/xxxxx.pem;
ssl_certificate_key C:/xxxxxx.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;
ssl_prefer_server_ciphers on;
root "D:/aaaWWW/ietaiji";
index index.html index.htm index.php;
location ~ \.php$ {
charset gb2312;
try_files $uri =404;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
最后https下的请求效果如下
HTTP的效果跟原来是一样的。
备注:SSL 是需要申请证书的,key和PEM文件要放到服务器路径。【我申请的是赛门铁克的】
然后NGINX下要进行443端口和80端口的绑定。
server {
listen 80;
server_name ietaiji.com www.ietaiji.com;
root "D:/aaa/WWW/ietaiji";
index index.html index.htm index.php;
location ~ \.php$ {
charset gb2312;
try_files $uri =404;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
server {
listen 443;
server_name ietaiji.com www.ietaiji.com;
ssl on;
ssl_certificate C:/xxxxx.pem;
ssl_certificate_key C:/xxxxxx.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;
ssl_prefer_server_ciphers on;
root "D:/aaaWWW/ietaiji";
index index.html index.htm index.php;
location ~ \.php$ {
charset gb2312;
try_files $uri =404;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
最后https下的请求效果如下
HTTP的效果跟原来是一样的。
相关文章推荐
- nginx的多域http、https同时访问配置及http重定向https
- Nginx配置同一个域名同时支持http与https两种方式访问
- 什么是ssl证书,什么是https,nginx如何配置ssl证书,兼容https与http同时访问站点
- Nginx配置域名同时支持 https 和 http 访问
- Nginx 负载均衡--(4)配置HTTPS 与 HTTP 同时存在
- Nginx配置https和http可同时访问方法
- Nginx 配置https 开启ssl 同时支持http
- nginx 反向代理 配置 https 实现http https同时存在 经测试 支持location 规则
- tomcat同时使用http和https访问的配置方法
- Nginx配置http强制跳转到https
- nginx配置https并强制http自动跳转到https
- https和http共存的nginx配置
- nginx+ssl配置http和https共存
- Nginx的安装与虚拟主机配置及HTTP和HTTPS共存配置
- Nginx同时反向代理http和https
- 从http到https简介,tomcat和nginx的https配置,单向认证和双向认证简介,对称加密和非对称加密简介,RSA算法简介
- Nginx配置HTTPS和HTTP
- 在 IIS 6 和 IIS 7中配置Https,设置WCF同时支持HTTP和HTPPS,以及使用HttpWebRequest和HttpClient调用HttpS
- Nginx的https配置记录以及http强制跳转到https的方法梳理