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

相关推荐
雨落Liy17 小时前
Nginx 从入门到进阶:反向代理、负载均衡与高性能实战指南
运维·nginx·负载均衡
Yyyy48217 小时前
Nginx负载均衡集群实验步骤
运维·nginx·负载均衡
ftpeak1 天前
从零开始使用 axum-server 构建 HTTP/HTTPS 服务
网络·http·https·rust·web·web app
qq_264220891 天前
Nginx优化与 SSL/TLS配置
运维·nginx
00后程序员张1 天前
详细解析苹果iOS应用上架到App Store的完整步骤与指南
android·ios·小程序·https·uni-app·iphone·webview
matlab的学徒1 天前
Web与Nginx网站服务(改)
linux·运维·前端·nginx·tomcat
邂逅星河浪漫1 天前
【Docker+Nginx+Ollama】前后端分离式项目部署(传统打包方式)
java·nginx·docker·部署
weixin_456904272 天前
使用HTTPS 服务在浏览器端使用摄像头的方式解析
网络协议·http·https
不会叫的狼2 天前
HTTPS + 域名 + 双向证书认证(下)
https
IT成长日记2 天前
【Nginx开荒攻略】Nginx主配置文件结构与核心模块详解:从0到1掌握nginx.conf:
linux·运维·nginx·配置文件