知识库

Loading

0 评论 / 0 点赞 / 502 阅读  安装部署 最后更新: 2022-09-20 作者: 飞致云 总字数: 1196

1 安装 Nginx

yum install gcc pcre-devel openssl-devel -y && \
cd /opt && \
wget http://nginx.org/download/nginx-1.20.2.tar.gz && \
tar -zxvf nginx-1.20.2.tar.gz && \
cd nginx-1.20.2 && \
./configure --prefix=/opt/nginx --with-http_stub_status_module --with-http_ssl_module  --with-http_realip_module --with-stream && \
make && make install

2 修改 Nginx 配置

备份配置文件:

cp /opt/nginx/conf/nginx.conf /opt/nginx/conf/nginx.conf.bak

将下列 server 加入 nginx.conf:

vim nginx.conf
     server {
                listen 8043 ssl;
		#修改为实际环境的域名
                server_name <域名>;
		#修改为实际证书
                ssl_certificate dataease.top_bundle.crt;
                ssl_certificate_key dataease.top.key;
                ssl_session_timeout 1d;
                ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
                ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
                ssl_prefer_server_ciphers on;
                location / {
			#将IP和端口改为DataEase服务器的访问地址和端口
                        proxy_pass   http://172.31.0.48:9876/;
                        server_name_in_redirect off;
                        proxy_redirect             http:// https://;
                        proxy_set_header           Host $host:$server_port;
                        proxy_set_header           X-Real-IP $remote_addr;
                        proxy_set_header           X-Forwarded-For $proxy_add_x_forwarded_for;
                        proxy_set_header           X-Forwarded-Proto $scheme;
                }
        }

3 启动 Nginx 并验证

启动 Nginx:

/opt/nginx/sbin/nginx

检查端口:

ss -an|grep 8043
tcp    LISTEN     0      128       *:8043                  *:*   

在浏览器通过 https 方式访问 Nginx 服务器,会跳转到 DataEase 的页面:

https://域名或IP:8043

图片.png

文章目录
其他资源