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;
}
相关推荐
Austindatabases41 分钟前
沧海要,《SQL SERVER 运维之道》,清风笑,竟惹寂寥
运维
2501_915918413 小时前
uni-app 项目 iOS 上架踩坑经验总结 从证书到审核的避坑指南
android·ios·小程序·https·uni-app·iphone·webview
游戏开发爱好者83 小时前
iOS 上架 uni-app 流程全解析,从打包到发布的完整实践
android·ios·小程序·https·uni-app·iphone·webview
ACRELKY4 小时前
光伏运维迎来云端革命!AcrelCloud-1200如何破解分布式光伏四大痛点?
运维·分布式
星期天要睡觉6 小时前
Linux 综合练习
linux·运维·服务器
saynaihe7 小时前
proxmox8升级到proxmox9
linux·运维·服务器
Delphi菜鸟7 小时前
docker 部署RustDesk服务
运维·docker·容器
Orchestrator_me7 小时前
CentOS交换区处理
linux·运维·centos
FLS1687 小时前
VMwaer虚拟机安装完Centos后无法联网问题
linux·运维·centos
OctopusMonster7 小时前
centos下gdb调试python的core文件
linux·运维·centos