How to install ngnix with 64-bit cent OS 6.2

Source: Internet
Author: User

From the Internet: cent os6.2 64-bit ngnix installation method.

Environment preparation:
Yum-y install gcc-c ++ autoconf automake make
Yum-y install zlib-devel openssl -- devel pcre-devel

Download nginx
Wget http://nginx.org/download/nginx-1.0.2.tar.gz

Extract
Tar-xzvf nginx-1.0.2.tar.gz
Cd nginx-1.0.2
./Configure

Configure supports the following options:

-- Prefix = <path>-Nginx installation path. If not specified, the default value is/usr/local/nginx.

-- Sbin-path = <path>-Nginx Executable File Installation path. It can only be specified during installation. If it is not specified, the default value is <prefix>/sbin/nginx.

-- Conf-path = <path>-the default nginx. conf path without the-c option. If not specified, the default value is <prefix>/conf/nginx. conf.

-- Pid-path = <path>-if no pid command is specified in nginx. conf, the default nginx. pid path is used. If not specified, the default value is <prefix>/logs/nginx. pid.

-- Lock-path = <path>-nginx. lock file path.

-- Error-log-path = <path>-default error log path when no error_log command is specified in nginx. conf. If not specified, the default value is <prefix>/logs/error. log.

-- Http-log-path = <path>-the default access log path when no access_log command is specified in nginx. conf. If not specified, the default value is <prefix>/logs/access. log.

-- User = <user>-the default nginx user if no user command is specified in nginx. conf. If not specified, the default value is nobody.

-- Group = <group>-the default group used by nginx when no user command is specified in nginx. conf. If not specified, the default value is nobody.

-- Builddir = DIR-specify the compiled directory

-- With-rtsig_module-enables the rtsig Module

Final Installation
Make & make install

Startup service:
You can write a script:
#! /Bin/bash
/Usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx. conf
Exit 0

Check whether the process has started:
Ps-ef | grep nginx
Check whether the port is occupied
Netstat-anp | grep 8080 view the specified port

Enter IP: PORT in the browser
Welcome to nginx!

Possible problems: whether the firewall has disabled iptables and selinux

To learn about Nginx, let's take a look at Zhang banquet's book "Practical Nginx: replacing Apache's high-performance Web server", mainly to teach people how to use Nginx.

****************************************

The following error occurs during red hat 6.2 64bit installation:

./Configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using -- without-http_rewrite_module
Option, or install the PCRE library into the system, or build the PCRE library
Statically from the source with nginx by using -- with-pcre = <path> option.

The solution is to download the regular expression dependency library of the Rewrite module: pcre

The pcre-8.02.tar.gz is selected

Http://sourceforge.net/projects/pcre? Source = dlp

Tar-zxvf pcre-8.02.tar.gz

Cd pcre-8.02

./Configure

Make

Make install

Then run./configure in nginx.

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.