2022-11-23 389
http 大家都知道是不安全的 然后想换成https
申请ssl证书
1.你得先有ssl证书(阿里云为例)
然后就是配置一下
审核完成之后就是下载证书了
下载完会有一个压缩包
你把压缩包解压放入你nginx.conf目录下就可以了
/www/server/nginx/conf (宝塔对应的目录)
重点来了
配置
nginx.conf
server {
listen 443 ssl;
#存放域名或者你服务的路径
server_name localhost;
#把证书放进conf目录下 然后就是对应着填写
ssl_certificate xxxxxx.pem;
ssl_certificate_key xxxxx.key;
#access_log logs/host.access.log main;
#后台管理静态资源存放
location / {
#文件目录
root html;
#首页的样式
index index.html;
}
location /prod-api {
#反向代理
proxy_pass xxxx.xxxx.xxxx;
}
}
server {
listen 80;
#域名
server_name xxxx.xxx.com xxxx.com;
#让所有访问80端口 http 的都跳转到443 也就是https
return 301 https://$server_name$request_uri;
root html;
}
成果展示:
总结
以上所述是小编给大家介绍的Nginx将http转换成https的详细过程,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对77isp云服务器技术网的支持!
原文链接:https://77isp.com/post/15908.html
=========================================
https://77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。
数据库技术 2022-03-28
网站技术 2022-11-26
网站技术 2023-01-07
网站技术 2022-11-17
Windows相关 2022-02-23
网站技术 2023-01-14
Windows相关 2022-02-16
Windows相关 2022-02-16
Linux相关 2022-02-27
数据库技术 2022-02-20
抠敌 2023年10月23日
嚼餐 2023年10月23日
男忌 2023年10月22日
瓮仆 2023年10月22日
簿偌 2023年10月22日
扫码二维码
获取最新动态