求一段nginx的配置。要求根据不同的来路域名,发送到不同的端口去处理。 nginx同域名配置多目录路径
求一段nginx的配置。要求根据不同的来路域名,发送到不同的端口去处理。
http {
upstream www
{
server xxx.xxx.xxx.xxx:8088 max_fails=3 fail_timeout=30s
}
upstream bbs
{
server xxx.xxx.xxx.xxx:8080 max_fails=3 fail_timeout=30s
}
server {
listen 80
server_name www.abc.com
location / {
index index.html index.php index.jsp index.htm
proxy_pass http://www
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
#proxy_connect_timeout 90
#proxy_send_timeout 90
#proxy_read_timeout 90
#proxy_buffers 32 4K
}
log_format $remote_addr - $remote_user [$time_local] $request
"$status" $body_bytes_sent "$http_referer"
"$http_user_agent" "$http_x_forwarded_for"
"$server_addr" "$upstream_addr "
}
server {
listen 80
server_name bbs.abc.com
location / {
index index.html index.php index.jsp index.htm
proxy_pass http://bbs
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
#proxy_connect_timeout 90
#proxy_send_timeout 90
#proxy_read_timeout 90
#proxy_buffers 32 4K
}
}
}#end of http
nginx同域名配置多目录路径
server{
server_name xxx.cn
charset utf-8
location / {
index index.html index.shtml
root /web/t 新路径
error_page 404 = @not_found
}
location @not_found {
index index.html index.shtml
root /web1/t 老路径
}
}
Nginx编译后修改路径问题
error.log在nginx.conf里面重新指定,就固定设置在/tmp吧,linux基本都有的位置
其它几个temp要在编译时指定,如
--http-client-body-temp-path=/tmp/client_body_temp
--http-proxy-temp-path=/tmp/proxy_temp
--http-fastcgi-temp-path=/tmp/fastcgi_temp