nginx初探


启动:nginx
停止:nginx -s stop


nginx启动后访问使用 http://localhost 就可以直接访问

nginx 加 两个tomcat 在windows平台下
    tomcat需要修改的内容,主要是端口不能重复,和打开群集
        a <Server port="8005" shutdown="SHUTDOWN">
          tomca的关闭端口
        b <Connector port="8081" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
          访问端口
        c <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" jvmRoute="tomcat81"/>
          控制nginx和tomcat的通信
        d <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
          控制群集

    nginx需要修改的内容,主要是配置文件
        a upstream tomcat-servers {
                ip_hash;
                server 127.0.0.1:8081;
                server 127.0.0.1:8088;
                }

        b  server {
                 ....
                 #location / {
                #    root   html;
                #    index  index.html index.htm;
                #}

                location / {
                    proxy_pass http://tomcat-servers;
                }

             ....
    
    启动顺序

        nginx,然后启动两个tomcat,访问http://localhost,即可

 

发布了52 篇原创文章 · 获赞 22 · 访问量 9万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章