求教 关于 nginx 地址转发的问题
ringa_lee
ringa_lee 2017-05-16 17:21:28
0
1
409

当请求访问 /test/下的文件是,转发到 ip : 80 端口上,这个在 nginx 下该如何配置

一下是配置文件内容
upstream api_servers {
server 127.0.0.1:9500;

http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive

keepalive 16;
}
server {
listen 80;
server_name www.yuming.com;
root /home/yuming/web;

listen 443 ssl;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;

location ~*.(jpg|gif|png|swf|flv|wma|wmv|asf|mp3|mmf|zip|rar|txt|amr|js|css|html?)$ {
root /home/yuming/web;
}

location / {
proxy_pass http://api_servers;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_http_version 1.1;
proxy_set_header Connection "";
}

}

ringa_lee
ringa_lee

ringa_lee

全部回复(1)
Ty80

location ^~ /目录/ {

    proxy_pass   http://ip:80;
}
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板