Nginx (1)

Source: Internet
Author: User

Nginx (pronounced with engine x) is a lightweight Web server/reverse proxy server and e-mail (IMAP/POP3) proxy server that is released under a bsd-like protocol. Developed by Russian program designer Igor Sysoev, originally used by Russia's large portal and search engine Rambler (Russian: Рамблер).

Why Choose Nginx?

-High concurrent connections
-Low memory consumption
-Low cost
-Simple configuration
-Support Rewrite rewrite
-Built-in health check
-Save Bandwidth
-Supports hot deployment
-High stability

Installing Nginx

There are 2 ways to install Nginx under Linux:

1. Using Nginx Packages

2. Download Nginx source code compilation

-Use Nginx Packages

For Rhel/centos, Nginx provides a yum library, which can be installed by Yum by creating the corresponding Yum repository file.

vim/etc/Yumrepos.d/Nginx.repo  #创建文件 # writes the following to the Nginx.repo file [nginx]name=nginx Repobaseurl=http://nginx.org/packages/mainline/centos/7/$basearch/gpgcheck=0 enabled=1yuminstall nginx  #安装nginx

-Compile and install

To compile and install Nginx, make sure that the development Tools "Server platfrom Development" package Group and Openssl-devel Zlib-devel Pcre-devel are installed.

Openssl-devel: Provides SSL functionality

Zlib-devel:nginx offers gzip modules and requires zlib library support

Pcre-devel:nginx provides rewrite functionality, requires Pcre library support

Yum " Development Tools " " Server platfrom Development " Yum Install openssl-devel zlib-devel pcre-devel

Nginx source code in http://nginx.org/en/download.html download.

wget http://nginx.org/download/nginx-1.10.0.tar.gz

Unzip and output compilation options

tar zxvf nginx* && cd nginx*. /configure--help

If you want to open a module of Nginx, add--with-xxx_module to the compilation option, and then add--without-xxx_module to close a module.

The simplest installation commands are as follows:

./Configuremake makeinstall

Custom compilation options:

./configure--prefix=/usr/local/Nginx--conf-path=/etc/nginx/nginx.conf--user=Nginx--group=Nginx--error-log-path=/var/log/nginx/Error.log--http-log-path=/var/log/nginx/Access.log--pid-path=/var/run/Nginx.pid--lock-path=/var/lock/Nginx.lock--with-Http_ssl_module--with-Http_stub_status_module--with-Http_gzip_static_module--with-Debug Make Make Install

Custom compilation options Install Nginx, after running the make command, compile the generated file information will be output.

Start Nginx:

/usr/local/nginx/sbin/nginx-c/etc/nginx/nginx.conf

Close Nginx:

Nginx-s Stop    -s quit    #正常关闭 # can also kill Nginx process with kill command to close Nginxkill -S quit 'cat /var/run/nginx.pid '

Reload the configuration file:

Nginx-s Reload

Reopen the log file:

Nginx-s Reopen

Nginx (1)

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.