upstream testService {
ip_hash;
server 192.168.1.150:8298;
}
server {
listen 80;
server_name localhost;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
client_max_body_size 100m;
client_body_buffer_size 100m;
location / {
ssi on;
ssi_silent_errors on;
ssi_types text/shtml;
root /opt/project/tp/tp_html/;
index index.html;
}
error_page 500 502 503 504 /50x.html;
# 导出文件根目录
location /files/ {
if ($request_filename ~* ^.*?.(txt|doc|rar|gz|zip|docx|exe|xlsx|ppt|pptx|xls)$){
add_header Content-Disposition attachment;
}
if ($request_filename ~* ^.*?.(pdf|jpg|png)$){
add_header Content-Disposition inline;
#add_header Content-Type application/pdf;
}
alias /usr/test/;
}
location ^~ /tp/ {
rewrite ^/tp/(.*)$ /$1 break;
index index.html;
proxy_pass http://testService;
}
location ^~ /test/tools/ {
rewrite ^/test/(.*)$ /other/$1 break;
index index.html;
proxy_pass http://testService;
}
location = /50x.html {
root html;
}
}
Nginx配置文件tp.conf
最新推荐文章于 2022-06-14 17:46:21 发布