Install Nginx source on CentOS

Source: Internet
Author: User

Steps:
wget http://nginx.org/download/nginx-1.10.1.tar.gztar -xvf nginx-1.10 . 1. Tar . GZCD nginx-1.10. 1 . /configruemake doinstall

Problems you may encounter in configure:

Install The PCRE library into the system, or build the PCRE library statically from the source with Nginx by usin G--with-pcre= option.

Workaround: Install Pcre-devel to solve the problem

Yum Install Pcre-devel
gzip Install the zlib library into the system, or build the Zlib library statically from the source with Nginx by usin G--with-zlib= option.

Workaround: Install Pcre-devel to solve the problem

Yum Install -y zlib-devel

Configuration summary obtained after completion of configure:

Configuration Summary

    • Using System PCRE Library
    • OpenSSL Library is not used
    • Using BUILTIN MD5 code
    • SHA1 Library is not found
    • Using System zlib Library
    • Nginx path prefix: "/usr/local/nginx"
    • Nginx binary file: "/usr/local/nginx/sbin/nginx"
    • Nginx modules path: "/usr/local/nginx/modules"
    • 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"
Yum installation Nginx

Nginx Official Document: http://nginx.org/en/linux_packages.html

To set up the Yum repository for Rhel/centos, create the file Named/etc/yum.repos.d/nginx.repo with the following content S

[Nginx]name=nginx repobaseurl=http://nginx.org/packages/os/osrelease/$basearch/ gpgcheck=0Enabled=1

Replace ' OS ' with ' rhel ' or ' CentOS ', depending on the distribution used, and ' osrelease ' with ' 5 ', ' 6 ', or ' 7 ', for 5.x, 6.x, or 7.x versions, respectively.

Once you have created a Yum source, you can install it directly using Yum:

Yum Install Nginx

Configure arguments common for nginx binaries from pre-built packages:

--prefix=/etc/Nginx--sbin-path=/usr/sbin/Nginx--conf-path=/etc/nginx/nginx.conf--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/run/Nginx.lock--http-client-body-temp-path=/var/cache/nginx/client_temp--http-proxy-temp-path=/var/cache/nginx/proxy_temp--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp--http-scgi-temp-path=/var/cache/nginx/scgi_temp--user=Nginx--group=Nginx--with-Http_ssl_module--with-Http_realip_module--with-Http_addition_module--with-Http_sub_module--with-Http_dav_module--with-Http_flv_module--with-Http_mp4_module--with-Http_gunzip_module--with-Http_gzip_static_module--with-Http_random_index_module--with-Http_secure_link_module--with-Http_stub_status_module--with-Http_auth_request_module--with-Threads--with-Stream--with-Stream_ssl_module--with-Http_slice_module--with-Mail--with-Mail_ssl_module--with-file-AIO--with-Http_v2_module--with-ipv6

Starting, stopping, and reloading Configuration

Http://nginx.org/en/docs/beginners_guide.html#control

To start Nginx, run the executable file. Once Nginx is started, it can be controlled by invoking the executable with the-s parameter. Use the following syntax:

Nginx-s Signal

Where signal May is one of the following:

    • Stop-fast shutdown
    • Quit-graceful shutdown
    • Reload-reloading the configuration file
    • Reopen-reopening the log files

For example, to-stop nginx processes with waiting for the worker processes-to-finish serving current requests, the FOLLOWI ng command can be executed:

Nginx-s quit

This command should is executed under the same user that started Nginx.

Changes made in the configuration file would not be applied until the command to reload configuration was sent to Nginx or I T is restarted. To reload configuration, execute:

Nginx-s Reload

Install Nginx source on CentOS

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.