我按照您的http://study.lishiming.net/chapter18.html安装的lnmp,但是不知道怎么在nginx下配置虚拟主机
0
log_format tm.abc.com '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
####################################################################################
server
{
listen 80;
server_name tm.abc.com;
# index index.shtml;
# root /usr/local/tomcat/manage-tomcat-7.0/webapps/manage;
#location ~ (\.html)|(\.png)|(\.ico)|(\.jpg)|(\.gif)|(\.shtml)|(\.css)|(\.js)|(\.jsp)|(\.do)|(\.action)$
location ~ (\.*)$
{
proxy_pass http://192.168.20.20:9001;#转向tomcat处理
include proxy.conf;
}
####################################
location /nginx-status {
# stub_status on;
access_log off;
}
####################################
# location ~ .*\(.swf)$ #设定访问静态文件直接读取不经过tomcat
location ~ .*\.(js|css)?$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
location ~ ^/WEB-INF/*
{
deny all;
}
#access_log /home/wwwlogs/access_t.abc.log tm.abc.com;
#access_log /home/wwwlogs/access_all.log tm.abc.com;
}
log_format tm.abc.com '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
####################################################################################
server
{
listen 80;
server_name tm.abc.com;
# index index.shtml;
# root /usr/local/tomcat/manage-tomcat-7.0/webapps/manage;
#location ~ (\.html)|(\.png)|(\.ico)|(\.jpg)|(\.gif)|(\.shtml)|(\.css)|(\.js)|(\.jsp)|(\.do)|(\.action)$
location ~ (\.*)$
{
proxy_pass http://192.168.20.20:9001;#转向tomcat处理
include proxy.conf;
}
####################################
location /nginx-status {
# stub_status on;
access_log off;
}
####################################
# location ~ .*\(.swf)$ #设定访问静态文件直接读取不经过tomcat
location ~ .*\.(js|css)?$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
location ~ ^/WEB-INF/*
{
deny all;
}
#access_log /home/wwwlogs/access_t.abc.log tm.abc.com;
#access_log /home/wwwlogs/access_all.log tm.abc.com;
}
编辑回复