Nginx installation and configuration

Source: Internet
Author: User
Tags openssl library

Nginx installation and configuration

System ubuntu14.04 64-bit

1. Library required by the installation Module
The gzip module requires the zlib library
The rewrite module requires the pcre Library
Openssl library is required for ssl Functions

sudo apt-get install zlib1g-devsudo apt-get install libpcre3 libpcre3-dev libpcrecpp0sudo apt-get install libssl-dev

2. Select a version of nginx http://nginx.org/en/download.html, use the wget tool to download the source package to the local. Here select 1.4.7.

wget http://nginx.org/download/nginx-1.4.7.tar.gz

Extract

tar zxvf nginx-1.4.7.tar.gz

3. Pre-installation Configuration
-With-http_stub_status_module: Support for nginx status query
-With-http_ssl_module: Support for https
-With-http_spdy_module: Support for google spdy, spdy is a TCP-based application layer protocol developed by Google, to minimize network latency and improve network speed
-With-pcre: To support rewrite, you must specify a pcre
-Prefix: Specifies the installation location.

Go to the nginx source code directory

cd nginx-1.4.7

Run the following command:

./configure --prefix=/usr/local/nginx-1.4.7 \--with-http_ssl_module --with-http_spdy_module \--with-http_stub_status_module --with-pcre

The following output indicates that the configuration is successful.

4. Compile
If make is not installed, install make first.

sudo apt-get install make

Compile

makemake install

5. Start, close, and restart
Start
Run the executable file directly.

/usr/loca/nginx-1.4.7/sbin/nginx

Stop

/usr/loca/nginx-1.4.7/sbin/nginx -s stop

Restart
Sometimes it is used when the configuration file is changed

/usr/loca/nginx-1.4.7/sbin/nginx -s reload

You can use curl to check whether nginx is successfully installed and running.

curl http://localhost

If successful, the following information is output:

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.