nginx配置https自签名(openssl生成)证书
发表于:2025-12-02 作者:千家信息网编辑
千家信息网最后更新 2025年12月02日,openssl生成证书openssl genrsa -out server.key 2048openssl req -new -key server.key -out server.csropenss
千家信息网最后更新 2025年12月02日nginx配置https自签名(openssl生成)证书
openssl生成证书
- openssl genrsa -out server.key 2048
- openssl req -new -key server.key -out server.csr
- openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
[nginx@machine certificate]$ openssl genrsa -out server.key 2048Generating RSA private key, 2048 bit long modulus..+++......................................................................+++e is 65537 (0x10001)[nginx@machine certificate]$ lltotal 4-rw-r----- 1 nginx nginx 1679 Jul 11 16:35 server.key[nginx@machine certificate]$ [nginx@machine certificate]$ openssl req -new -key server.key -out server.csrYou are about to be asked to enter information that will be incorporatedinto your certificate request.What you are about to enter is what is called a Distinguished Name or a DN.There are quite a few fields but you can leave some blankFor some fields there will be a default value,If you enter '.', the field will be left blank.-----Country Name (2 letter code) [XX]:cnState or Province Name (full name) []:gdLocality Name (eg, city) [Default City]:gzOrganization Name (eg, company) [Default Company Ltd]:aiOrganizational Unit Name (eg, section) []:aiCommon Name (eg, your name or your server's hostname) []:Email Address []:Please enter the following 'extra' attributesto be sent with your certificate requestA challenge password []:An optional company name []:[nginx@machine certificate]$ [nginx@machine certificate]$ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crtSignature oksubject=/C=cn/ST=gd/L=gz/O=ai/OU=aiGetting Private key[nginx@machine certificate]$ lltotal 12-rw-r----- 1 nginx nginx 1099 Jul 11 16:36 server.crt-rw-r----- 1 nginx nginx 952 Jul 11 16:35 server.csr-rw-r----- 1 nginx nginx 1679 Jul 11 16:35 server.key[nginx@machine certificate]$ nginx配置
[nginx@machine ~]$ cd /etc/nginx/
[nginx@machine nginx]$ more nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"';access_log /var/log/nginx/access.log main;sendfile on;#tcp_nopush on;keepalive_timeout 65;#gzip on;upstream zuul_nginx { server 10.13.22.104:8080; server 10.13.22.105:8080; server 10.13.22.106:8080; server 10.13.22.107:8080;}server { listen 18010 ssl; #listen 443 ssl; #server_name 10.13.22.124; ssl on; ssl_certificate /app/nginx/certificate/server.crt; ssl_certificate_key /app/nginx/certificate/server.key; ssl_session_timeout 5m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #ssl_ciphers HIGH:!aNULL:!MD5; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; ssl_prefer_server_ciphers on; location /ouyidaorder { proxy_pass http://zuul_nginx; }}server { listen 8080 ssl; ssl on; ssl_certificate /app/nginx/certificate/server.crt; ssl_certificate_key /app/nginx/certificate/server.key; ssl_session_timeout 5m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; ssl_prefer_server_ciphers on; location /ouyidaorder { proxy_pass http://zuul_nginx; }}include /etc/nginx/conf.d/*.conf;}
用root重启nginx。
测试
(1)浏览器访问:https://10.13.22.124:8080/ouyidaorder/api/Subscribe
(2)curl https://10.13.22.124:18010/ouyidaorder/api/Subscribe
证书
生成
配置
浏览器
测试
浏览
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
河南丰巢网络技术有限公司
率土之滨服务器选择
亿家安互联网科技直播间
php连接mdb数据库
网络安全行业股票有哪些
网络技术学院大学排名
天津智慧园区管理平台软件开发
小米无法修改接入点服务器
山东企业软件开发费用
天鸿网络安全工程师
教育行业网络安全标准规范
网络安全简笔画图案大全
系统坏了带数据库的软件如何保存
csgo自定义服务器录制比赛
网络技术负责人需要做什么
iis asp数据库写入
四川时代网络技术服务技术
网络安全线上知识竞赛评价
如何查看自己的云服务器被谁登录
数据库索性排序
奥迪服务器连不上网
南昌鲲鹏服务器订购
互联网金融及科技有限公司
上海世像互联网科技有限公司
网络安全法海报
穿越火线的服务器号
如何设置时间服务器
江苏省英雄联盟服务器虚拟主机
金山区推广软件开发哪家好
墨西哥服务器不能到日服玩