1. 主配置文件nginx.conf
存放全局性质的配置
2. conf.d/default.conf配置文件
此文件夹一般存放业务性质配置,可以配置多个,复制default.conf文件,并保证端口号等不一致即可。
server {
server_name 127.0.0.1; # 替换成实际的域名
listen 80; # 替换成实际的端口叿
root /usr/share/nginx/html/resilient-city-admin;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
location /api/assess/saveAccessReportFile {
proxy_pass http://10.3.9.27:4444/assess/saveAccessReportFile;
}
location /onlinePreview {
proxy_pass http://10.3.9.27:8012/onlinePreview;
}
location /upload/ {
alias /data/resilientCityFile/upload/;
}
location /api {
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_pass http://resilient-city-gateway:10101/api; #替换成实际的服务host
keepalive_timeout 36000;
proxy_connect_timeout 36000;
proxy_read_timeout 36000;
add_header Access-Control-Allow-Origin *;
}
#location /geoserver {
# proxy_pass http://10.3.9.27:8080/geoserver;
#}
}