36 lines
1.3 KiB
Plaintext
36 lines
1.3 KiB
Plaintext
|
|
server {
|
||
|
|
listen 8011; # 监听 8011 端口
|
||
|
|
server_name 106.53.194.199; # 运维机 的公网 IP
|
||
|
|
|
||
|
|
allow 43.159.145.241; # 只允许海外服务器的 IP 访问
|
||
|
|
allow 49.51.46.148;
|
||
|
|
allow 192.168.70.13;
|
||
|
|
allow 192.168.70.7;
|
||
|
|
deny all; # 拒绝其他所有 IP
|
||
|
|
|
||
|
|
access_log /data/tengine/logs/agent_access.log;
|
||
|
|
error_log /data/tengine/logs/agent_error.log;
|
||
|
|
|
||
|
|
location / {
|
||
|
|
proxy_pass http://192.168.70.7:8090; # 反向代理到本地电脑的dev的8090
|
||
|
|
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_intercept_errors off;
|
||
|
|
proxy_buffering off;
|
||
|
|
proxy_cache off;
|
||
|
|
proxy_set_header Connection keep-alive;
|
||
|
|
|
||
|
|
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;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|