Compile and install Nginx

Source: Internet
Author: User

System version: centos6.4

Tools: nginx-1.8.1.tar.gz, pcre-8.37.tar.gz

Set up the build environment:

Local Source: yum-y Groupinstall "Development Tools" "Server Platform Development"

Put the tool nginx-1.8.1.tar.gz, pcre-8.37.tar.gz under/root, so

Tar XF pcre-8.37.tar.gz

CD pcre-8.37

./configure--prefix=/usr/local/pcre

Make && make install

Note: Nginx Install the required library: Pcre Library, install Pcre Library is for Nginx support HTTP rewrite module

Then start installing Nginx:

Useradd-m-s/sbin/nologin Nginx

Tar XF nginx-1.8.1.tar.gz

./configure--user-user--group-nginx--prefix=/usr/local/nginx-1.8.1--with-http_stub_status_module--with-http_ Ssl_module--with-pcre=/usr/local/pcre

Make

Note: When the./configure finishes executing make, the following error occurs:

cd/usr/local/pcre/\
&& If [-f Makefile]; then make distclean; fi \
&& cc= "gcc" cflags= "-o2-fomit-frame-pointer-pipe" \
./configure--disable-shared
/bin/sh:line 2:./configure:no such file or directory
make[1]: * * * [/usr/local/pcre//makefile] Error 127

Then view the compiled parameters

./configure--help found the following:

--with-pcre=dir set path to Pcre library sources: set route to Pcre repository source

So change the pcre path again.

./configure--user-user--group-nginx--prefix=/usr/local/nginx-1.8.1--with-http_stub_status_module--with-http_ Ssl_module--with-pcre=/root/pcre-8.37

Make

Make install

This compiles the nginx to complete

Ln-s/USR/LOCAL/NGINX-1.8.1//usr/local/nginx

[Email protected] nginx-1.8.1]#/usr/local/nginx/sbin/nginx-t

Nginx:the configuration file/usr/local/nginx-1.8.1/conf/nginx.conf syntax is OK

Nginx:configuration file/usr/local/nginx-1.8.1/conf/nginx.conf Test is successful


Compile and install 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.