openssl genrsa -des3 -out www.example.com.pem 1024
openssl rsa -in www.example.com.pem -out www.example.com.key
openssl req -new -key www.example.com.pem -out www.example.com.csr
mkdir -p demoCA/newcerts touch demoCA/index.txt touch demoCA/serial echo "01" > demoCA/serial
upstream sslfpm {
server 127.0.0.1:9000 weight=10 max_fails=3 fail_timeout=20s;
}
server {
listen 192.168.1.*:443;
server_name 192.168.1.*;
#为一个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 SSLv3 TLSv1;
#指定许可的密码描述
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
#SSLv3和TLSv1协议的服务器密码需求优先级高于客户端密码
ssl_prefer_server_ciphers on;
location / {
root /home/wangzhengyi/ssl/;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
error_page 404 /404.html;
location = /50x.html {
root /usr/share/nginx/www;
}
location = /404.html {
root /usr/share/nginx/www;
}
# proxy the PHP scripts to fpm
location ~ \.php$ {
access_log /var/log/nginx/ssl/ssl.access.log main;
error_log /var/log/nginx/ssl/ssl.error.log;
root /home/wangzhengyi/ssl/;
fastcgi_param HTTPS on;
include /etc/nginx/fastcgi_params;
fastcgi_pass sslfpm;
}
}
#优化ssl服务 ssl_session_cache shared:wzy:10m; #客户端能够重复使用存储在缓存中的会话参数时间 ssl_session_timeout 10m;
server {
listen 192.168.1.111:80;
server_name test.com;
rewrite ^(.*)$ https://$host$1 permanent;
}
error code 497 497 - normal request was sent to HTTPS
server {
listen 192.168.1.11:443; #ssl端口
listen 192.168.1.11:80; #用户习惯用http访问,加上80,后面通过497状态码让它自动跳到443端口
server_name test.com;
#为一个server{......}开启ssl支持
ssl on;
#指定PEM格式的证书文件
ssl_certificate /etc/nginx/test.pem;
#指定PEM格式的私钥文件
ssl_certificate_key /etc/nginx/test.key;
#让http请求重定向到https请求
error_page 497 https://$host$uri?$args;
}
index.html <html> <meta http-equiv="refresh" content="0;url=https://test.com/"> </html>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有