Nginx Tomcat 域名组合配置
#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;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
upstream tianducheng.cn {
server 115.159.110.82:8888 max_fails=1 fail_timeout=10s;
server 115.159.110.82:8888 max_fails=1 fail_timeout=10s;
}
server {
listen 80;
server_name tianducheng.cn;
location / {
proxy_pass http://tianducheng.cn/jeeshop;
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 1;
proxy_read_timeout 30;
}
location /img {
root /usr/local/www/nginx;
proxy_connect_timeout 1;
proxy_read_timeout 10;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
root /usr/java/apache-tomcat-7.0.67/webapps/jeeshop/;
if (-f $request_filename) {
expires 1d;
break;
}
}
location ~ .*\.(js|css)$
{
root /usr/java/apache-tomcat-7.0.67/webapps;
if (-f $request_filename) {
expires 1d;
break;
}
}
rewrite ^(.*)\;jsessionid=(.*)$ $1 break;
underscores_in_headers on;
}
}
猜你喜欢
转载自zhouguofeng.iteye.com/blog/2271299
今日推荐
周排行