模拟线上环境,在本地以域名访问系统思路
1、首先在hosts文件将域名映射为本地IP
2、假如服务器80端口已被占用,可以用nginx转发,在nginx/vhosts/abc.com加入如下配置
server
{
listen 80;
server_name abc.com;
location / {
proxy_pass http://abc.com:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Frowarded-For $proxy_add_x_forwarded_for;
}
access_log /apps/logs/nginx/abc.com.access.log log_access;
}
3、在tomcat配置域名指向的目录及日志格式
<Host name="abc.com" appBase="webapps_abc"
unpackWARs="true" autoDeploy="true">
<Context path="" docBase="/apps/svr/apache-tomcat-7.0.54/webapps_abc/product-admin-web" debug="0" reloadable="true"/>
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="abc.com_access_log." suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>