您的位置:首页 > 运维架构 > Nginx

Linux \windows的Nginx静态代理配置文件

2017-07-06 15:58 435 查看
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;
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: