1.安装nginx
2.配置nginx.conf::
server{
listen 80;server_name weixin.xxx.com;(域名)
charset utf-8;
location / {
proxy_pass http://localhost:81;(指向服务器81端口本地项目tomcat)
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$(解析图片)
{
root D:/web/cmmsweixin;
if (-f $request_filename) {
expires 1d;
break;
}
}
location ~ .*\.(js|css)$(js|css)
{
root D:/web/cmmsweixin;
if (-f $request_filename) {
expires 1d;
break;
}
}
}