1.環(huán)境說(shuō)明
win7 系統(tǒng)
nginx-1.9.4
apache-tomcat-7.0.63
2.修改配置
nginx.conf
upstream tomcat {
server 192.168.18.202:8080 fail_timeout=0;
#ip_hash;
}
server {
listen 8090;
server_name 192.168.18.202;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_connect_timeout 240;
proxy_send_timeout 240;
proxy_read_timeout 240;
proxy_pass http://tomcat;
}
}
tomcat滓玖,server.xml
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
<Context path="" reloadable="false" docBase="E:\wcp-web" workDir="E:\wcp-web"/>
</Host>
3.啟動(dòng)
啟動(dòng)tomcat
startup.bat
啟動(dòng)Nginx
cmd
cd D:\nginx-1.9.4
D:\nginx-1.9.4>nginx
停止Nginx
D:\nginx-1.9.4>nginx -s stop
4.訪問(wèn)
https://localhost:8090/