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;
}
相关推荐
Drache_long28 分钟前
DevOps
运维·devops
不像程序员的程序媛38 分钟前
nginx日志配置
运维·nginx
hopsky1 小时前
phoenix docker 启动
运维·docker·容器
又熟了1 小时前
乌班图Ubuntu安装
linux·运维·ubuntu
无情的西瓜皮1 小时前
MCP协议实战:从零搭建一个AI Agent工具服务器
运维·服务器·python
Do_GH1 小时前
【Linux】09.WSL+SVN部署操作说明
linux·运维·svn
哈德森hh2 小时前
我的 Twitter 自动化运营流程
运维·自动化·twitter
ElevenS_it1882 小时前
连锁门店IT运维监控实战:200+门店网络设备+POS统一纳管+按区域分组告警路由完整配置(Zabbix Proxy架构)
运维·网络·架构·zabbix
dualven_in_csdn2 小时前
mqtt消息及日志查看
linux·运维·服务器
呉師傅2 小时前
东芝e-STUDIO 3525ac提示黄色和品红色墨粉盒在耗尽前被更换。请重新插入之前的墨粉盒并用至耗尽如何操作
运维·windows·电脑