Enter the /usr/local directory and execute the following 1 2 3 4, where Road King corresponds to the installation of nginx later, you need to pay attention*
Source code compilation depends on environment
apt-get install build-essential
apt-get install libtool
// gcc --version View gcc version// gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
PCRE (Perl Compatible Regular Expressions) is a Perl library, including Perl compatible regular expression libraries. The http module of nginx uses pcre to parse regular expressions
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
tar -zxvf pcre-8.38.tar.gz
cd pcre-8.38./configure
make
make install
The zlib library provides many ways to compress and decompress, nginx uses zlib to gzip the contents of the http package
wget http://zlib.net/zlib-1.2.11.tar.gz
tar -zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11./configure
make
make install
OpenSSL is a powerful secure socket layer cryptographic library, including the main cryptographic algorithms, commonly used key and certificate packaging management functions and SSL protocols, and provides a wealth of applications for testing or other purposes.
Nginx not only supports the http protocol, but also supports https (that is, HTTP is transmitted on the ssl protocol)
wget https://www.openssl.org/source/openssl-1.0.2n.tar.gz
tar -zxvf openssl-1.0.2n.tar.gz
wget https://nginx.org/download/nginx-1.8.1.tar.gz
tar -zxvf nginx-1.8.1.tar.gz
Install nginx to the /usr/local/nginx directory
cd nginx-1.8.1//Configure nginx./configure --sbin-path=/usr/local/nginx/nginx \
- - conf-path=/usr/local/nginx/nginx.conf \
- - pid-path=/usr/local/nginx/nginx.pid \
- - with-http_ssl_module \
- - with-pcre=/usr/local/pcre-8.38 \
- - with-zlib=/usr/local/zlib-1.2.11 \
- - with-openssl=/usr/local/openssl-1.0.2n
//Compile
make
//installation
make install
At this point nginx installation is complete!
It is recommended to use the first startup, otherwise the following error may occur
nginx:[error]open()"/***/***/***/nginx.pid"failed(2: No such file or directory)
The first
cd /usr/local/nginx
. /nginx -c ./nginx.conf
The second
/usr/local/nginx/nginx
Reload configuration
. /nginx -s reload
apt-get install nginx
The startup program file is in /usr/sbin/nginx
The logs are placed in /var/log/nginx, which are access.log and error.log respectively
And the startup script nginx has been created under /etc/init.d/
/etc/init.d/nginx start
More nginx learning recommendations: http://www.nginx.cn
Recommended Posts