美文网首页
Nginx+tomcat部署记录

Nginx+tomcat部署记录

作者: codeMan_6616 | 来源:发表于2017-08-18 14:28 被阅读14次

    1.环境说明

    win7 系统
    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.启动

    启动tomcat
        startup.bat
    启动Nginx
        cmd
        cd D:\nginx-1.9.4
        D:\nginx-1.9.4>nginx
    停止Nginx
        D:\nginx-1.9.4>nginx -s stop
    

    4.访问

    https://localhost:8090/

    相关文章

      网友评论

          本文标题:Nginx+tomcat部署记录

          本文链接:https://www.haomeiwen.com/subject/wnlarxtx.html