Installing Nginx server under Linux

Source: Internet
Author: User
Tags nginx server

Before installing Nginx, first install the compilation environment GCC and g++, and then use CentOS as an example to install Nginx, install nginx need Prce Library, zlib Library and SSL support, in addition to SSL outside the other we are to the official website to download:

nginx:http://nginx.org/

pcre:http://www.pcre.org/

zlib:http://www.zlib.net/

First, prepare the package, upload it to the server, and start the installation.

First release the Pcre, and do not install:

tar -xvzf pcre-8.38. tar. gz

Then release zlib:

tar -xvzf zlib-1.2. 8. tar. gz

Installing OpenSSL:

Yum Install OpenSSL openssl-devel

Release Nginx:

tar -xvzf nginx-1.9. 8. tar. gz

Then execute the CD nginx-1.9. 8 Enter the directory to start compiling the installation Nginx:

./configure--sbin-path=/usr/local/nginx/nginx--conf-path=/usr/local/nginx/nginx.conf--pid-path=/usr/local/ Nginx/nginx.pid--with-http_ssl_module--with-pcre=. /pcre-8.38 --with-zlib=. /zlib-1.2. 8  Make  Make Install

Attention.. /pcre-8.38 and. /zlib-1.28 is the source directory of the Pcre and Zlib just released, and the compile-time Nginx will be compiled together

A little wait for the compilation installation to complete, the installation location is the beginning of the specified/usr/local/nginx, configuration file location:/usr/local/nginx/nginx.conf

Then determine if the 80 port is not occupied, start the Nginx service:

/usr/local/nginx/nginx

After successful startup, you can see the initial page by using your browser to access the corresponding IP.

  

Here, the Nginx server is installed successfully.

In addition to the start command, some common nginx commands are as follows:

Check the correctness of the nginx.conf configuration file: /usr/local/nginx/nginx-t

Restart Nginx: /usr/local/nginx/nginx-s Reopen

Stop Nginx: /usr/local/nginx/nginx-s Stop

Reload configuration file: /usr/local/nginx/nginx-s Reload

  

Installing Nginx server under 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.