The general situation is: To configure the Nginx two domain names, a dedicated to handle the static resources of the request: 172.17.2.137:9001
One is to process the dynamic request: www.palmpaly.com This domain name is based on the following path and reverse proxy to two different servers,
One server specializes in file uploads, and one server handles other action requests
#user nobody;
Worker_processes 1;
#error_log Logs/error.log;
#error_log Logs/error.log Notice;
#error_log Logs/error.log Info;
#pid Logs/nginx.pid;
Events {
Worker_connections 1024;
}
HTTP {
Include Mime.types;
Default_type Application/octet-stream;
#log_format Main ' $remote _addr-$remote _user [$time _local] "$request" '
# ' $status $body _bytes_sent ' $http _referer '
# ' "$http _user_agent" "$http _x_forwarded_for" ';
#access_log Logs/access.log Main;
Client_max_body_size 500m;
Sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
Keepalive_timeout 65;
#gzip on;
Upstream palmnager.com {#上传
Server 172.17.2.137:8081;
}
Upstream palmnager2.com {
Server 172.17.2.137:8082;
}
server {
Listen 9001;
server_name 172.17.2.137;
CharSet Utf-8;
#设置网站的根目录
Location/{
Root e:/nginx-static;
}
}
server {
Listen 80;
server_name www.palmpaly.com;
CharSet Utf-8;
location/palmplayupload/{
Proxy_pass http://palmnager.com;
Proxy_set_header Host $host;
Proxy_set_header X-real-ip $remote _addr;
Proxy_set_header x-forwarded-for $remote _addr;
}
location/palmplaymanager/{
Proxy_pass http://palmnager2.com;
Proxy_set_header Host $host;
Proxy_set_header X-real-ip $remote _addr;
Proxy_set_header x-forwarded-for $remote _addr;
}
}
# HTTPS Server
#
#server {
# Listen 443;
# server_name localhost;
# SSL on;
# ssl_certificate Cert.pem;
# Ssl_certificate_key Cert.key;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers high:!anull:! MD5;
# ssl_prefer_server_ciphers on;
# location/{
# root HTML;
# index index.html index.htm;
# }
#}
}
This article is from the "re-learn Java" blog, please be sure to keep this source http://3131854.blog.51cto.com/3121854/1550057
The response proxy configuration of nginx under window