Linux under source installation Nginx (Ubuntu and CentOS Universal)

Source: Internet
Author: User
Tags gz file install openssl openssl openssl library

1. Download Nginx, link address: http://nginx.org/download/ nginx-1.12.2.tar.gz, select the Linux version (. tar.gz) (Nginx version is 1.12.2) 2. Download Nginx Dependency Package: 1.gzip module requires zlib library (http://zlib.net) (zlib-1.2.11.tar.gz) 2.rewrite module requires the Pcre Library (https://ftp.pcre.org/pub/pcre/pcre-8.41.tar.gz) 3.ssl function requires the OpenSSL library (https ://www.openssl.org/source/openssl-fips-2.0.16.tar.gz)
Do not want to trouble can also be downloaded according to my link: https://download.csdn.net/download/zhangbaoss/102761313. Confirm that the following libraries are installed before installation (CentOS system with the following command) Yum install Perlyum Install Gccyum installs Gcc-c++yum-y installed NET-TOOLS4. Installation steps: 1) place the installation package in the/home/zhangbao/nginx_install directory, such as:

You can also download these compressed packages in the Nginx_install directory, as follows:

<1> Enter the Nginx_install directory:cd/home/zhangbao/nginx_install<2> input command: wget-c http://zlib.net/ Zlib-1.2.11.tar.gz (Enter the above address in order to download the installation package), running the results such as:
2) Install openssl-fips-2.0.16.tar.gz, execute command as follows:<1> enter/home/zhangbao/nginx_install directory: Cd/home/zhangbao/nginx_install
<2> Unzip openssl-fips-2.0.16.tar.gz file: Tar-zxvf openssl-fips-2.0.16.tar.gz
<3> into the openssl-fips-2.0.16 unpacking package: CD openssl-fips-2.0.16

<4> run the config file in the current directory and use prefix to configure the installation path:./config--prefix=/home/zhangbao/openssl-fips-2.0.16

The/home/zhangbao directory has more than one openssl-fips-2.0.16 folder, such as:

<5> Run make command: Go to the/home/zhangbao/nginx_install/openssl-fips-2.016 folder and run the Make command

<6> Run the Make install command when there is no problem:

<7> No error indicates openssl-fips-2.0.16.tar.gz installation succeeded 3) install zlib-1.2.11.tar.gz, execute command as follows: <1>cd/home/zhangbao/nginx _INSTALL&LT;2&GT;TAR-ZXVF ZLIB-1.2.11.TAR.GZ&LT;3&GT;CD zlib-1.2.11<4>./configure--prefix=/home/zhangbao/ Zlib-1.2.11<5>cd/home/zhangbao/nginx_install/zlib-1.2.11<6>make<7>make INSTALL4) Install pcre-8.41.tar.gz, execute command:<1>cd/home/zhangbao/nginx_install<2>tar-zxvf  Pcre-8.41.tar.gz<3>cd pcre-8.41<4>./configure--PREFIX=/HOME/ZHANGBAO/PCRE-8.41&LT;5&GT;CD/ Home/zhangbao/nginx_install/pcre-8.41<6>make<7>make install5) Install nginx-1.12.2, execute the command as follows: <1>cd/home /ZHANGBAO/NGINX_INSTALL&LT;2&GT;TAR-ZXVF NGINX-1.12.2.TAR.GZ&LT;3&GT;CD nginx-1.12.2<4> The with-pcre is used to specify the location of the Pcre dependency package, prefix configures the installation path./configure--with-pcre=. /pcre-8.41--with-zlib=. /zlib-1.2.11--with-openssl=. /openssl-fips-2.0.16--prefix=/home/zhangbao/nginx-1.12.2<5>cd/home/zhangbao/nginx_install/nginx-1.12.2 <6>make<7>make install5. Detect if Nginx installationSuccessful:<1> into the/home/zhangbao/nginx-1.12.2/sbin directory (here is the Nginx installation directory) <2> Run command:./nginx-t

<3> appears as shown in the prompt, indicating that the installation was successful

<4> if running the Times below error:

<5> indicates that the value of listen in the server in the/home/zhangbao/nginx-1.12.2/conf/nginx.conf file is 80, which I modified to 8088, which is normal after the run

6. Modify the method:<1> first look at the nginx.conf file in the server listen value is 80, is the next step, not please Baidu. Go to/home/zhangbao/nginx-1.12.2/conf directory, open nginx.conf file: 1) cd/home/zhangbao/nginx-1.12.2/conf,2) Cat nginx.conf

<2> use Vim to modify the nginx.conf file. Run the command vim nginx.conf

<3> Click the "I" button on the keyboard to insert the operation, then use the upper and lower keys on the keyboard to move the cursor

<4> Modify Listen value to 8088 (numeric keypad not available)

<5> Click ESC, then click shift+: Key back to input interface, enter WQ to save and close, at this time listen value has been changed to 8088, you can use cat nginx.conf View Listen value <6> return to/home/ Zhangbao/nginx-1.12.2/sbin directory, run the./nginx-t command to see if Nginx installation is successful

7. Start Nginx:

Enter the/home/zhangbao/nginx-1.12.2/sbin directory and run the./nginx command, at this point, nothing happens.

8. See if Nginx started successfully: Enter command NETSTAT-NTLP

The 6th step has changed the listen port number to 8088, at this point the display has been successfully launched in the browser input URL and port number into the following interface:

9. Stop Nginx:

Run the command:./nginx-s stop

At this point the 8088 port is no longer running, indicating that Nginx has stopped

10. After changing the configuration file, you need to restart Nginx if you want the configuration to take effect: Run the command:./nginx-s reload11. Configure the cluster:<1> to add the statements shown in the nginx.conf configuration file:

<2> configuration file added statement meaning specific reference my other article, Windows installation Nginx step: http://blog.csdn.net/zhangbaoss/article/details/79463618

<3>nginx deployed on 192.168.1.99 machine, Tomcat and project placed on my computer after IP is 192.168.1.9<4> two tomcat are started, enter the project address in the page, accessed as follows:

12.Linux system Nginx installed to this has been completed, I wish you good luck!

Linux under source installation Nginx (Ubuntu and CentOS Universal)

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.