Nginx installed on Ubuntu

Source: Internet
Author: User
Tags openssl library

Nginx is a high-performance HTTP and reverse proxy server.

Nginx uses the './configure && make && make install ' procedure used under Unix to compile the installation.

The Configure script determines the characteristics of the system, especially the method that Nginx uses to handle the connection. It then creates the Makefile file.

Official website: http://nginx.org/
Download page: http://nginx.org/download/nginx-1.2.6.tar.gz
1. Module dependencies
Gzip module requires zlib library
Rewrite module requires Pcre library
The SSL feature requires the OpenSSL library
Pre-compiled installation packages
sudo apt-get install libpcre3 libpcre3-dev libpcrecpp0 Libssl-dev Zlib1g-dev

2, nginx preparation
Download nginx-1.2.6.tar.gz package to the directory you specified, unzip:
Tar zxvf nginx-1.2.6.tar.gz
After decompression, in the current directory will generate a nginx-1.2.6 directory
into the extracted directory, run the Configure command,
 ./configure--prefix=/usr/local/nginx
A following error is reported:
./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 S Ystem, or build the PCRE library
statically from the source with Nginx by using--with-pcre= option.
This is due to the absence of the Pcre library, the following command to install the relevant Lib can be resolved


3, the installation of Pcre library:
Official website: http://www.pcre.org/
Download page: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
Select Latest version Download: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.10.tar.gz
1) Unzip:
TAR–ZXVF pcre-8.10.tar.gz
Unzip the directory as: pcre-8.10
Then go to CD pcre-8.10, configure, compile, install
2) configuration
./configure--prefix=/usr/local/pcre
3) Compiling Pcre
Make
Make Pcre Error
libtool:compile:unrecognized option '-dhave_config_h '
Libtool:compile:Try ' Libtool--help ' for more information.
MAKE[1]: * * * [Pcrecpp.lo] Error 1
MAKE[1]: Leaving directory '/home/mfcai/pcre-8.10 '
Make: * * * [ALL] Error 2
Installing Build-essential
Apt-get Install Build-essential
4) Install Pcre
Make install

4, installation of Nginx
1) configuration
./configure--prefix=/usr/local/nginx--with-pcre=/usr/local/pcre/
Note: Here instead of the installed path, it should be the path to the Pcre source file
The correct command is:
./configure--prefix=/usr/local/nginx--with-pcre=/usr/local/src/pcre-8.10
2) compiling
Make
3) Installation
Make install

Nginx will be installed in the/usr/local/nginx directory (you can also use the parameter--prefix= to specify the location you want),
After successful installation, there are four subdirectories in the/usr/local/nginx directory: conf, HTML, logs, Sbin.
Where Nginx configuration files are stored in the conf/nginx.conf,
The bin file is an nginx file located in the Sbin directory.
Ensure that the 80 port of the system is not occupied by other programs, run the Sbin/nginx command to start Nginx,
Open the browser to access the IP of this machine if the browser appears Welcome to nginx! Indicates that Nginx is installed and running successfully

Nginx installed on Ubuntu

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.