How to configure nginx in CentOs6.5

Source: Internet
Author: User
Download the latest Nginx Web site ghost download the latest Nginx Web site http://nginx.org/en/download.html


Wget http://nginx.org/download/nginx-0.8.53.tar.gz


Decompress and download the source code package.
Tar-zxvf nginx-0.8.53.tar.gz


Go to the decompressed source code folder
Cd nginx-0.8.53


Configure nginx
./Configure -- prefix =/opt/nginx -- with-http_stub_status_module
Explanation: -- prefix indicates the installation path and -- with-indicates the module to be installed. you can run./configure -- help to view the valid module.


Compile and install nginx
Make & make install
-------------------------------------
Installation prompt:
./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 = Option.


Solution:
The above prompt shows that the PCRE library needs to be installed.
You can download one from below. I downloaded one from the beginning, but it still won't work. later, the next version is high!
Ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/


Decompress and download the source code package.
Tar-zxvf pcre-8.34.tar.gz


Go to the decompressed source code folder
Cd pcre-8.34


Run:
./Configure
Make
Make install


-------------------------------------


Start nginx
/Opt/nginx/sbin/nginx


-------------------------------------
Tip:
/Opt/nginx/sbin/nginx: error while loading shared libraries: libpcre. so.1: cannot open shared object file: No such file or directory


Solution:
Ldd/opt/nginx/sbin/nginx ====> check whether the linked library is normal
Linux-vdso.so.1 => (0x00007fff25dff000)
Libcrypt. so.1 =>/lib64/libcrypt. so.1 (0x00007f549c495000)
Libpcre. so.1 => not found ====> the corresponding library is not found.
Libcrypto. so.10 =>/usr/lib64/libcrypto. so.10 (0x00007f549c0b4000)
Libz. so.1 =>/lib64/libz. so.1 (0x00007f549be9e000)
Libc. so.6 =>/lib64/libc. so.6 (0x00007f549bb0a000)
Libfreebl3.so =>/lib64/libfreebl3.so (0x00007f549b892000)
Libdl. so.2 =>/lib64/libdl. so.2 (0x00007f549b68e000)
/Lib64/ld-linux-x86-64.so.2 (0x00007f549c6d2000)



Ln-s libpcre. so.0.0.1 libpcre. so.1
-------------------------------------


Start nginx again
/Opt/nginx/sbin/nginx


Check whether nginx is started properly
Ps-ef | grep nginx
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.