Linux \windows的Nginx靜態代理配置檔案
阿新 • • 發佈:2019-02-05
Linux:
upstream app.time-weekly.com { server 127.0.0.1:8080; } server { listen 80; server_name app.time-weekly.com; index index.html index.htm; charset utf-8; # ignore favicon.ico not exist. location = /favicon.ico { log_not_found off; access_log off; } # not allow to visit hidden files. location ~ /\. { deny all; access_log off; log_not_found off; } location /blobs/ { alias /home/data/blobs/; expires 7d; } location /images/ { alias /home/data/images/; expires 7d; } location /audios/ { alias /home/data/audios/; expires 7d; } location /videos/ { alias /home/data/video/; expires 7d; } location / { if ($request_filename ~* ^.*?\.(txt|doc|pdf|rar|gz|zip|docx|exe|xlsx|ppt|pptx)$) { add_header Content-Disposition: 'attachment;'; add_header Content-Type: 'APPLICATION/OCTET-STREAM'; } proxy_pass http://app.time-weekly.com; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REQUEST_HOST $host; charset UTF-8; } }
windows:
upstream static.vlms.cn { server 127.0.0.1:8080; } server { listen 80; server_name static.vlms.cn; index index.html index.htm; charset utf-8; # ignore favicon.ico not exist. location = /favicon.ico { log_not_found off; access_log off; } # not allow to visit hidden files. location ~ /\. { deny all; access_log off; log_not_found off; } location /blobs/ { alias "D:/home/data/blobs/"; expires 7d; } location /images/ { alias "D:/home/data/images/"; expires 7d; } location /audios/ { alias "D:/home/data/audios/"; expires 7d; } location /videos/ { alias "D:/home/data/video/"; expires 7d; } location / { if ($request_filename ~* ^.*?\.(txt|doc|pdf|rar|gz|zip|docx|exe|xlsx|ppt|pptx)$) { add_header Content-Disposition: 'attachment;'; add_header Content-Type: 'APPLICATION/OCTET-STREAM'; } proxy_pass http://static.vlms.cn; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REQUEST_HOST $host; charset UTF-8; } }