nginx部署https域名ssl证书

1、在你服务器nginx文件夹下创建ssl文件夹存放证书文件和秘钥文件

把.crt和.key证书放上

2、在nginx.conf文件中配置

在nginx.conf文件中server下加入listen 443 ssl;

复制代码
  server {
	listen       443 ssl;
	charset utf-8;
    index index.html index.htm index.jsp index.do;
    add_header Cache-Control no-cache;
    root /opt/apm/;
	server_name  apm.jomoo.cn;

	ssl_certificate      /usr/local/nginx/ssl/scs_server.crt;
	ssl_certificate_key  /usr/local/nginx/ssl/scs_server.key;

	ssl_session_cache    shared:SSL:1m;
	ssl_session_timeout  5m;

	ssl_ciphers  HIGH:!aNULL:!MD5;
	ssl_prefer_server_ciphers  on;
    location /card/alert {
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header Host $host;
		proxy_pass http://10.1.1.1:7777/card/alert;
	}
    location /card/now {
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header Host $host;
		proxy_pass http://10.1.1.1:7777/card/alert;
	}
	location /console {
		try_files $uri $uri/ /console/index.html;
	}
	location /console/api/system {
		proxy_buffer_size 64k;
      	proxy_buffers  32 32k;
       	proxy_busy_buffers_size 128k;
		proxy_set_header X-Real-IP    $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header Host $host;
	    proxy_pass http://10.0.10.10:10000/nisbos/system;
	}

    location /console/api/niscommon {
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header Host $host;
		proxy_pass http://10.0.10.10:10000/niscommon;
	}
    location /console-scheduler/ {
		proxy_set_header Host $http_host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header REMOTE-HOST $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_pass http://10.0.10.10:10000/;
	}
  }
3、重启nginx

/usr/local/nginx/sbin/nginx -s reload

nginx安装ssl模块http_ssl_module

https://blog.csdn.net/weixin_44371237/article/details/135840006

访问不了,检查一下443端口有没有开

https://blog.csdn.net/weixin_44371237/article/details/135846457

相关推荐
xujiangyan_20 小时前
nginx的反向代理和负载均衡
服务器·网络·nginx
大乔乔布斯1 天前
AttributeError: module ‘smtplib‘ has no attribute ‘SMTP_SSL‘ 解决方法
python·bash·ssl
Aa美少女战士1 天前
单域名 vs 通配符:如何选择最适合你的 SSL 证书?
网络协议·https·ssl
咕噜签名1 天前
如何申请p12证书
网络协议·https·ssl
2a3b4c1 天前
SSL/TLS
网络协议·https·ssl
viqecel1 天前
网站改版html页面 NGINX 借用伪静态和PHP脚本 实现301重定向跳转
nginx·php·nginx重定向·301重定向·html页面重定向
硪就是硪2 天前
内网环境将nginx的http改完https访问
nginx·http·https
鹅肝手握高V五色2 天前
Wireshark入门教程:如何抓取和过滤网络数据包
websocket·网络协议·tcp/ip·http·网络安全·https·udp
云上艺旅2 天前
K8S学习之基础七十二:Ingress基于Https代理pod
学习·云原生·容器·https·kubernetes
ak啊2 天前
Nginx 安全加固详细配置指南
nginx