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.