Installing Nginx on "Linux" Linux

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

This article describes the Linux environment installation Nginx, the Linux system used here is CentOS 7.2.

1. Download Nginx from Nginx website. The version used here is: 1.13.6.

2. Upload the downloaded nginx to Linux, take the/opt/nginx directory as an example. Run "tar-zxvf nginx-1.13.6.tar.gz" to decompress.

3. Switch to the/opt/nginx/nginx-1.13.6 directory and run the./configure to initialize the configuration. If the following prompts, indicating that the machine is not installed Pcre, and nginx needs to rely on pcre, need to manually install Pcre, see http://www.linuxidc.com/Linux/2015-03/114986.htm.

installation Pcre :

PCRE (perl Compatible Regular Expressions) is a lightweight Perl library of functions, including a Perl-compatible regular expression library. It is much smaller than a regular expression library like boost. The pcre is very easy to use and also powerful, with performance exceeding the POSIX regular expression library and some classic regular expression libraries.

1. Go to this https://sourceforge.net/projects/pcre/files/pcre/download Pcre, here is the version of the download is 8.40.

2. Upload the pcre-8.40.tar.gz to the/opt/pcre directory, run "tar-zxvf pcre-8.40.tar.gz", extract the pcre-8.40 directory, and run Chmod–r 777 pcre-8.40 Grant full read and write permissions to the current folder.

3. Enter the/pcre-8.40 directory, run the ./configure to initialize the configuration, print a bunch of information, if the following prompt, because the C + + compiler is missing.

Workaround: Install the C + + compiler by using the yum–y install gcc-c++ command.

The C + + compiler runs again after the installation is successful ./configure.

4. Perform a make operation to compile.

5. Finally execute the Make install command, and the installation is complete at this pcre.

Go back to the/opt/nginx/nginx-1.13.6 directory, run the./configure to initialize the Nginx configuration, and finally print out the following information to prove successful, the Red arrow pointing to the address is the path to start Nginx.

(Note: When running./configure for Nginx initialization configuration, if you want to add an SSL module, you can use the following command:

./configure–-prefix=/usr/local/nginx–-with-http_ssl_module

If you do not have OpenSSL installed when you execute the above command, you will be prompted:

./CONFIGURE:ERROR:SSL modules require the OpenSSL library.

At this time first execute yum–y install OpenSSL openssl-devel, after the installation of OpenSSL can be carried out smoothly on the above operation)

4. Run make install for installation

5. To the/usr/local/nginx/sbin directory, run the./nginx and start Nginx.

6. Test whether the installation started successfully, enter the server IP: port (default 80) in the browser, and if it appears, the boot has been successfully installed.

Nginx Common commands:

View Nginx process: Ps–ef|grep nginx

Start Nginx, execute in/usr/local/nginx/sbin directory:./nginx

Off Nginx: In the/usr/local/nginx/sbin directory, execute:./nginx-s quit

Nginx configuration file is in/usr/local/nginx/conf/nginx.conf, when the configuration file nginx.conf modified, to allow the configuration to restart Nginx, this can be used./nginx-s Reload You can let the modified configuration take effect, so you don't have to stop and start

Installing Nginx on "Linux" Linux

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.