Nginx+tomcat binding domain name configuration record

Source: Internet
Author: User
Record the use of Nginx to do reverse proxy, Tomcat for the Web container domain name binding process.
First of all, of course, you need to configure the domain name in the domain manager to point to their own server IP (of course, the domain name does not have to say a hair!). )
And then it's the Nginx configuration.

    • Nginx Basic Configuration:

Find nginx/conf/nginx.conf and do the following key configurations:

#配置upstream节点,这里节点名为“xx”        116.255.111.111:8080;  }  server{        80;        server_name  #这里配置nginx需要代理的域名        location / {                #指定反向代理为上面配置的那个upstream节点“xx”                proxy_set$http_host;                proxy_set$remote_addr;                proxy_set$proxy_add_x_forwarded_for;        }    }

Nginx Basic configuration of these, if you want to bind multiple domain names, you can more than a few servers, change the server server_name and port.
The upstream node indicates the access path to the proxy service, which can be used for load balancing, as detailed in detail: http://tengine.taobao.org/book/chapter_05.html#upstream-100
Nginx information online A lot, here is one example: http://tengine.taobao.org/book/index.html
Now you can open tomcat on the server, startup, browser input domain name a visit, pass! The page is out! The only thing that comes out is Tomcat's default interface, and now we need to configure Tomcat to get the request into the specified project,

    • Tomcat Basic configuration:
      Find Conf/server.xml under Tomcat.
      Comment out the default localhost this section of the host configuration, add the following host configuration:

  
   
    
   "www.xxx.xx"  appBase=
   
    "/opt/tomcat7.0/webapps/testweb"  unpackWARs=
   
    "true" autoDeploy=
   
    "true">         
   
    
     
    "" docBase=
    
     "/opt/tomcat7.0/webapps/testweb" debug=
    
     "0" reloadable=
    
     "true" />         
    
     
      
     "org.apache.catalina.valves.AccessLogValve" directory=
     
      "logs" prefix=
     
      "localhost_access_log." suffix=
     
      ".txt" pattern=
     
      "%h%l%u%t "%r" %s%b" /><
     
      /Host>
    
     
   
    
  
   

OK, now restart Tomcat, access "www.xxx.xx", Jump to "/opt/tomcat7.0/webapps/testweb" under the project went.
Configuration is very personal experience, not a complete reference, here is just a simple note.

'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
  • '). Text (i)); }; $numbering. FadeIn (1700); }); });

    The above describes the Nginx+tomcat binding domain name configuration records, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.