Install nginx in centos

Source: Internet
Author: User
Tags install openssl openssl library

1. Download stable version of nginx. http://nginx.org/en/download.html

2. Run the following command to install

# Check System path [[email protected] USR] # PWD/usr # decompress to current path [[email protected] USR] # tar-zxv-F nginx-1.6.2.tar.gz # Delete compressed package [[email protected] USR] # rm-RF nginx-1.6.2.tar.gz # Go To The unzip package [[email protected] USR] # cd nginx-1.6.2/[[email protected] nginx-1.6.2] # specify the installation path [[email protected] nginx-1.6.2] #. /configure -- prefix =/usr/local/nginx # compile [[email protected] nginx-1.6.2] # Make # Install [[email protected] nginx-1.6.2] # make install # Roll back to the top of the decompressed package directory [[email protected] USR] # CD .. /# unzipping package [[email protected] USR] # rm nginx-1.6.2-RF

3. Prompt for missing package installation

Error message. /configure: error: the HTTP rewrite module requires the PCRE Library. you can either disable the module by using -- without-http_rewrite_moduleoption, or install the PCRE Library into the system, or build the PCRE librarystatically from the source with nginx by using -- With-PCRE = <path> option. solution [[email protected] nginx-1.6.2] # Yum-y install PCRE-devel
Error message. /configure: error: the HTTP gzip module requires the zlib library. you can either disable the module by using -- without-http_gzip_moduleoption, or install the zlib library into the system, or build the zlib librarystatically from the source with nginx by using -- With-zlib = <path> option. solution [[email protected] nginx-1.6.2] # Yum install-y zlib-devel
Error message :. /configure: error: the HTTP cache module requires MD5 functionsfrom OpenSSL library. you can either disable the module by using -- without-http-Cache option, or install the OpenSSL library into the system, or build the OpenSSL library statically from the source with nginx by using -- with-http_ssl_module -- With-OpenSSL = <path> options. solution [[email protected] nginx-1.6.2] # Yum-y install OpenSSL-devel

4. Modify the Firewall Configuration:

# Modify the Firewall Configuration: [[email protected] nginx] # vi +/etc/sysconfig/iptables # Add configuration item-A input-M state -- state new-m tcp-p tcp -- dport 80-J accept # restarting the Firewall
[[email protected] nginx]# service iptables restart

5. Start nginx

# Method 1
[[Email protected] nginx] #/usr/local/nginx/sbin/nginx-C/usr/local/nginx/CONF/nginx. conf

# Method 2
[[email protected] nginx]# cd /usr/local/nginx/sbin [[email protected] sbin]# ./nginx

6. Check whether nginx is enabled.

[[email protected] nginx]# netstat -ntlp

Or

# Test port [[email protected] nginx] # netstat-Na | grep 80
# Test http: // ip: 80 in the browser

Appendix:

# Query the nginx master process number [[email protected] sbin] # ps-Ef | grep nginx # Stop the process [[email protected] sbin] # Kill-Quit master process number # Stop quickly [[email protected] sbin] # Kill-term master process number # force stop [[email protected] sbin] # pkill-9 nginx

For more information, see [http://www.cnblogs.com/zhoulf/archive/2013/02/09/2909653.html].

Install nginx in centos

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.