nginx配置,如下:
user 3w;
worker_processes 2;
pid/tmp/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';
sendfileon;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
upstream demo_plcxue {
server 127.0.0.1:8080;
}
upstream xunkebao {
server 127.0.0.1:8081;
}
server {
listen 80;
server_name demo.plcxue.com;
index index.html index.htm index.jsp;
access_log /opt/3w/logs/nginx/plcxue.log; #设定访问日志的存放路径
error_log /opt/3w/logs/nginx/plcxue.err;
location ^~ /media/ {
alias /opt/3w/plcxue/current/media/;
}
location ^~ /widgets/ {
alias /opt/3w/plcxue/current/widgets/;
}
location / {
client_max_body_size5m;
proxy_connect_timeout 30;
proxy_pass http://demo_plcxue;
}
}
server {
listen 80;
server_name sms.xunkebao.com;
index index.html index.htm index.jsp;
access_log /opt/3w/logs/nginx/xunkebao.log; #设定访问日志的存放路径
error_log /opt/3w/logs/nginx/xunkebao.err;
location ^~ /media/ {
alias /opt/3w/sms/current/media/;
}
location ^~ /widgets/ {
alias /opt/3w/sms/current/widgets/;
}
location / {
client_max_body_size5m;
proxy_connect_timeout 30;
proxy_pass http://xunkebao;
}
}
}