开发日志

yum install nginx


一般安装目录在/etc/nginx


/etc/nginx 建立vhost目录


nginx.conf 倒数第二行(大括号上面)增加include vhost/*.conf;


vhost目录里面增加文件 www.test.com.conf

文件内容为:

server

{

listen       80;

server_name test.com www.test.com;

index index.html;

if ($host != 'www.test.com') {

rewrite ^/(.*)$ http://www.test.com/$1 permanent;

}

root  /data/website/test;


location /

{

proxy_pass http://localhost:10002;

proxy_redirect off;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header Host $http_host;

}


location /status

{

stub_status on;

access_log   off;

}


location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$

{

expires      30d;

}


location ~ .*\.(js|css)?$

{

expires      12h;

}


#access_log off;

#access_log  /data/logs/test.log  access;


}



发表评论
请先 登录后评论