Server Building 2

Source: Internet
Author: User
Tags sha1
1.Copy the Nginx installation package to the/opt/nginx directory, modify the permissions, unzip, and compile the installation. Root@iz25n0utdnmz:/opt/nginx# chmod 777 nginx-1.9.3.tar.gzRoot@iz25n0utdnmz:/opt/nginx# ls-lTotal848-rwxrwxrwx1Root root864430The3 -:Panax Notoginsengnginx-1.9. 3. Tar.gzroot@iz25n0utdnmz:/opt/nginx# TAR-ZXVF nginx-1.9.3.tar.gzroot@iz25n0utdnmz:/opt/nginx/nginx-1.9. 3#./configure...... (many outputs) ... checking forPCRELibraryinch/usr/include/pcre/...Not foundchecking forPCRELibraryinch/usr/pkg/...Not foundchecking forPCRELibraryinch/opt/local/...Not found./configure:error:the HTTP rewrite module requires the PCRE library. You can either disable the module by using--without-http_rewrite_moduleoption, or install the PCRELibraryInto the system, or build the PCRELibraryStatically from theSourceWith Nginx by using--with-pcre=
  
   option. Hint missing pcre, download pcre and copy to/opt/pcre directory, modify permissions, unzip, compile and install, Root@iz25n0utdnmz:/opt/pcre
   # chmod 777 pcre-8.37.tar.gzRoot@iz25n0utdnmz:/opt/pcre
   # ls-lTotal
   1996-rwxrwxrwx
   1Root root
   2041593The
   5
    -:
    topcre-
   8.37. tar.gzroot@iz25n0utdnmz:/opt/pcre
   # TAR-ZXVF pcre-8.37.tar.gzroot@iz25n0utdnmz:/opt/pcre/pcre-
   8.37
   #./configureroot@iz25n0utdnmz:/opt/pcre/pcre-
   8.37
   # makeroot@iz25n0utdnmz:/opt/pcre/pcre-
   8.37
   # make installAfter installing PCRE, continue to install nginx.root@iz25n0utdnmz:/opt/nginx/nginx-
   1.9
   . 3
   #./configure...... (many outputs) ... checking
    forSha1
   inchSystem MD
   Library
   ...Not foundchecking
    forSha1
   inchSystem OpenSSL Crypto
   Library
   ...Not foundchecking
    forZlib
   Library
   ...Not found./configure:error:the HTTP gzip module requires the Zlib library. You can either disable the module by using--without-http_gzip_moduleoption, or install the zlib
   LibraryInto the system, or build the zlib
   LibraryStatically from the
   SourceWith Nginx by using--with-zlib=
   
    option. Hint missing zlib, download zlib and copy to/zlib/zlib directory, modify permissions, unzip, compile and install, root@iz25n0utdnmz:/opt/zlib
    # chmod 777 zlib-1.2.8.tar.gzRoot@iz25n0utdnmz:/opt/zlib
    # ls-lTotal
    560-rwxrwxrwx
    1Root root
    571091The
    5
     -:
     thezlib-
    1.2
    . 8. tar.gzroot@iz25n0utdnmz:/opt/zlib
    # TAR-ZXVF zlib-1.2.8.tar.gzroot@iz25n0utdnmz:/opt/zlib/zlib-
    1.2
    . 8
    #./configureroot@iz25n0utdnmz:/opt/zlib/zlib-
    1.2
    . 8
    # makeroot@iz25n0utdnmz:/opt/zlib/zlib-
    1.2
    . 8
    # make installAfter installing zlib, continue to install nginx.root@iz25n0utdnmz:/opt/nginx/nginx-
    1.9
    . 3
    #./configureConfiguration Summary + using System PCRE
    Library+ OpenSSL
    Libraryis not used + using BUILTIN MD5 code + SHA1
    Libraryis not found + using system zlib
    LibraryNginx Path Prefix:
    "/usr/local/nginx"Nginx binary file:
    "/usr/local/nginx/sbin/nginx"Nginx Configuration prefix:
    "/usr/local/nginx/conf"Nginx configuration file:
    "/usr/local/nginx/conf/nginx.conf"Nginx pid File:
    "/usr/local/nginx/logs/nginx.pid"Nginx Error log file:
    "/usr/local/nginx/logs/error.log"Nginx HTTP access log file:
    "/usr/local/nginx/logs/access.log"Nginx HTTP client request body temporary files:
    "Client_body_temp"Nginx HTTP proxy temporary files:
    "Proxy_temp"Nginx http fastcgi Temporary files:
    "Fastcgi_temp"Nginx http Uwsgi Temporary files:
    "Uwsgi_temp"Nginx http scgi Temporary files:
    "Scgi_temp"root@iz25n0utdnmz:/opt/nginx/nginx-
    1.9
    . 3
    # makeroot@iz25n0utdnmz:/opt/nginx/nginx-
    1.9
    . 3
    # make installNote: The Ginx default is in the Ann under/usr/local/nginx.
    2.Start, restart, and stop Nginx.root@iz25n0utdnmz:/usr/local/nginx/sbin
    #./nginxRoot@iz25n0utdnmz:/usr/local/nginx/sbin
    #./nginx-s ReloadRoot@iz25n0utdnmz:/usr/local/nginx/sbin
    #./nginx-s Stop
    3.Nginx and Tomcat integrated configuration. Open the Nginx configuration file nginx.conf, where the following configuration is added: reference configuration
    1.Conf.location ~ \.mvc {proxy_pass/HTTP/
    101.201
    . the
    . 5:
    8080;} The important configuration is as follows: server {Listen
     the;    server_name localhost; Location ~ \.mvc {proxy_pass/HTTP/
    101.201
    . the
    . 5:
    8080; }} This configuration means: Server monitoring
     thePort, when there is a request ending with. MVC, the server gives the request to the agent for processing. The rest of the configuration is not described in detail. Note You can use the NGINX-T directive to verify that the configuration file is configured correctly. Root@iz25n0utdnmz:/usr/local/nginx/sbin
    #./nginx-tNginx:the configuration file/usr/local/nginx/conf/nginx.conf syntax is oknginx:configuration file/usr/local/nginx/ Conf/nginx.conf Test is successful
    4.Nginx and Tomcat Load balancer configuration. Open the Nginx configuration file nginx.conf, where the following configuration is added: reference configuration
    2.Conf.upstream MyServer {Server
    101.201
    . the
    . 5:
    8080weight=
    1; Server
    101.201
    . the
    . 5:
    8081weight=
    1;} server {Listen
     the;    server_name localhost;    Location ~ \.mvc {Proxy_pass http://myserver; }} This configuration means: Server monitoring
     thePort, when there is a request ending with. MVC, the server gives the request to the agent for processing, and the proxy points to a list of servers, through upstream configuration, by name MyServer matching, two servers in the server list, ports are
    8080,
    8081, the weights are
    1, the Nginx will send the request by
    1:
    1To two servers, note that if a server is paralyzed or does not exist at all, it does not affect the business, and the other server processes all requests. Another tomcat server.xml file configuration needs to be modified in the following places:
    8005Switch
    8006:
    
     
      "8006" shutdown= 
      "shutdown" > Change 
      8080 to 
      8081: 
      
       "8081" protocol= "http/1.1 
        " c>" 20000 "redirectport= 
       " 8443 "/> Change 
       8009 to 
       8010: 
       
        " 8010 "protocol= 
        "ajp/1.3" redirectport= 
        "8443 "/> If two services are working properly, you can log the log to test two services to handle different requests, as follows: Log4j.appender.file.file=/log/tomcat1/aplay-web.loglog4j.appender.file.file=/log/tomcat2/aplay-web.log
        
      

     
    
   
  

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The above describes the server Building 2, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Related Article

    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.