Nginx 基础应用实战 04 在公网配置配置HTTPS

Nginx 基础应用实战 04

在公网配置配置HTTPS

Nginx配置

复制代码
     server {
             listen       443 ssl;
             server_name  aa.abc.com;

             ssl_certificate      /data/cert/server.crt;
             ssl_certificate_key  /data/cert/server.key;

     }

免费签名

https://freessl.cn

阿里云

腾讯云

Nginx配置

复制代码
server {
    #SSL 访问端口号为 443
    listen 443 ssl;
 #填写绑定证书的域名
    server_name duozuiyu.com;
 #证书文件名称
    ssl_certificate duozuiyu.com.crt;
 #私钥文件名称
    ssl_certificate_key duozuiyu.com.key;
    location / {
    #网站主页路径。此路径仅供参考,具体请您按照实际目录操作。
        root html;
        index  index.html index.htm;
    }
}

编译时报错

复制代码
nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf:98
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed

解决方法:

  1. 重新编译 增加ssl模块

    ./configure --with-http_stub_status_module --with-http_ssl_module

  2. 执行 make

​ make执行完之后 不要执行install

  1. 备份
  2. 替换文件
  3. 启动Nginx
  4. 访问https

java项目的负载均衡

反向代理java项目

1.安装jdk

复制代码
yum install java-1.8.0-openjdk

2.上传项目

3.让https反向代理到本机Tomcat

复制代码
proxy_pass http://127.0.0.1:8080;

4.负载均衡

复制代码
  upstream httpd {
    server 192.168.43.152:80;
    server 192.168.43.153:80;
}
相关推荐
Lana学习中37 分钟前
【运维杂记】连接不上远程服务器的问题处理
运维·服务器
AOwhisky1 小时前
MySQL 学习笔记(第一期):数据库基础与 MySQL 初探
运维·数据库·笔记·学习·mysql·云计算
Peace1 小时前
【Prometheus】
linux·运维·prometheus
唐装鼠2 小时前
Nginx + Gunicorn + Python Web 应用 架构(Claude)
python·nginx·gunicorn
LZZ and MYY3 小时前
RTS 在windows和Linux之间ShareMem
linux·运维·服务器
zt1985q3 小时前
本地部署源代码管理解决方案 Bitbucket Data Center 并实现外部访问
运维·服务器·数据库·网络协议·postgresql·源代码管理
极客先躯3 小时前
高级java每日一道面试题-2026年01月18日-实战篇[Docker]-如何清理仓库中的旧镜像?
java·运维·docker·容器
禹凕4 小时前
Linux基础——环境
linux·运维·服务器·ubuntu
二营长14 小时前
后端请求https协议接口地址报错
网络协议·http·https
爱喝水的鱼丶4 小时前
SAP-ABAP:SAP基础数据校验工具开发系列博客(共5篇)第三篇:SAP接口对接开发:实现数据的实时/批量校验交互
运维·数据库·学习·性能优化·sap·abap·经验交流