mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-10 20:57:14 +08:00
优化:优化部署配置(后端服务使用独立域名 api.charles7c.top 提供服务)
This commit is contained in:
@@ -21,13 +21,48 @@ http {
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
# 后端项目
|
||||
upstream admin-server {
|
||||
ip_hash;
|
||||
server 172.17.0.1:18000;
|
||||
}
|
||||
|
||||
server {
|
||||
# listen 80;
|
||||
listen 443 ssl;
|
||||
server_name api.charles7c.top;
|
||||
|
||||
# 证书直接存放 /docker/nginx/cert 目录下即可(更改证书名称即可,无需更改证书路径)
|
||||
ssl on;
|
||||
ssl_certificate /etc/nginx/cert/xxx.local.pem; # /etc/nginx/cert/ 为 docker 映射路径 不允许更改
|
||||
ssl_certificate_key /etc/nginx/cert/xxx.local.key; # /etc/nginx/cert/ 为 docker 映射路径 不允许更改
|
||||
ssl_session_timeout 5m;
|
||||
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
location / {
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header REMOTE-HOST $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://admin-server/;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root html;
|
||||
}
|
||||
}
|
||||
|
||||
# HTTP 请求 将转发到 HTTPS
|
||||
server {
|
||||
listen 80;
|
||||
server_name api.charles7c.top;
|
||||
rewrite ^ https://$http_host$request_uri? permanent;
|
||||
}
|
||||
|
||||
# 前端项目
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name cnadmin.charles7c.top;
|
||||
|
||||
@@ -49,14 +84,6 @@ http {
|
||||
error_page 405 =200 https://$host$request_uri;
|
||||
}
|
||||
|
||||
location ~*/(auth|captcha) {
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header REMOTE-HOST $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://admin-server;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root html;
|
||||
|
Reference in New Issue
Block a user