初始化提交
This commit is contained in:
110
nacos/nacosweb.scalelink.cn.conf
Normal file
110
nacos/nacosweb.scalelink.cn.conf
Normal file
@@ -0,0 +1,110 @@
|
||||
upstream nacos_backend {
|
||||
# Nacos 节点 IP + 管理端口
|
||||
server 172.24.16.13:8081 max_fails=3 fail_timeout=30s;
|
||||
server 172.24.16.7:8081 max_fails=3 fail_timeout=30s;
|
||||
server 172.24.16.10:8081 max_fails=3 fail_timeout=30s;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name nacosweb.scalelink.cn;
|
||||
|
||||
# 对外暴露
|
||||
location / {
|
||||
proxy_pass http://nacos_backend;
|
||||
proxy_set_header Host $host;
|
||||
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;
|
||||
|
||||
# 可选:增加连接和读写时间
|
||||
# proxy_connect_timeout 30s;
|
||||
# proxy_send_timeout 30s;
|
||||
# proxy_read_timeout 30s;
|
||||
|
||||
# 可选:避免大请求限制
|
||||
# client_max_body_size 10m;
|
||||
|
||||
# 允许跨域
|
||||
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
|
||||
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,X-Requested-With,Accept,Origin' always;
|
||||
# 处理预检请求
|
||||
if ($request_method = OPTIONS ) {
|
||||
return 204;
|
||||
}
|
||||
}
|
||||
# 专用日志
|
||||
access_log /data/tengine/logs/nacosweb_access.log combined_ext;
|
||||
}
|
||||
|
||||
|
||||
# ==================================
|
||||
|
||||
upstream outnacos_backend {
|
||||
# 硅谷 Nacos 节点机器 加入广州openvpn 192.168.70.0/24 网段 管理端口
|
||||
server 192.168.70.5:8081 max_fails=3 fail_timeout=30s;
|
||||
server 192.168.70.29:8081 max_fails=3 fail_timeout=30s;
|
||||
server 192.168.70.34:8081 max_fails=3 fail_timeout=30s;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name outnacos.scalelink.cn;
|
||||
|
||||
# 日志
|
||||
access_log /data/tengine/logs/outnacos.scalelink.cn.access.log;
|
||||
error_log /data/tengine/logs/outnacos.scalelink.cn.error.log warn;
|
||||
|
||||
# 对外暴露
|
||||
location / {
|
||||
proxy_pass http://outnacos_backend;
|
||||
proxy_set_header Host $host;
|
||||
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;
|
||||
|
||||
# 允许跨域
|
||||
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
|
||||
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,X-Requested-With,Accept,Origin' always;
|
||||
|
||||
if ($request_method = OPTIONS) {
|
||||
return 204;
|
||||
}
|
||||
}
|
||||
|
||||
# 给静态资源加缓存
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
proxy_pass http://nacos_backend;
|
||||
|
||||
# 浏览器缓存 7 天
|
||||
expires 7d;
|
||||
add_header Cache-Control "public, max-age=604800, immutable";
|
||||
|
||||
proxy_set_header Host $host;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
upstream nacos_backend {
|
||||
# Nacos 节点 公网 IP + 管理端口
|
||||
server 公网IP:8081 max_fails=3 fail_timeout=30s;
|
||||
server 公网IP:8081 max_fails=3 fail_timeout=30s;
|
||||
server 公网IP:8081 max_fails=3 fail_timeout=30s;
|
||||
}
|
||||
|
||||
upstream nacos_backend {
|
||||
# Nacos 节点 加入广州openvpn 192.168.70.0/24 网段 管理端口
|
||||
server 192.168.70.5:8081 max_fails=3 fail_timeout=30s;
|
||||
server 192.168.70.29:8081 max_fails=3 fail_timeout=30s;
|
||||
server 192.168.70.34:8081 max_fails=3 fail_timeout=30s;
|
||||
}
|
||||
Reference in New Issue
Block a user