0
点赞
收藏
分享

微信扫一扫

配置NGINX同时运行 https 和 http

春意暖洋洋 2022-12-13 阅读 158


为配合APP STORE 要求HTTPS来访问请求,所以需要改造网站HTTP和HTTPS都能访问。


备注:SSL 是需要申请证书的,key和PEM文件要放到服务器路径。【我申请的是赛门铁克的】


然后NGINX下要进行443端口和80端口的绑定。


最后https下的请求效果如下

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;
}
}

配置NGINX同时运行 https 和 http_ci

HTTP的效果跟原来是一样的。




举报

相关推荐

0 条评论