ubuntu install nginx server

version####


Front-end environment configuration###

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*

1、 gcc

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
2、 PCRE ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/

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 
3、 zlib http://zlib.net

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 
4、 penssl https://www.openssl.org/source/

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

installation steps###

1. Source code installation####

1. Download nginx compressed package#####
wget https://nginx.org/download/nginx-1.8.1.tar.gz

2. Unzip nginx-1.8.1.tar.gz
tar -zxvf nginx-1.8.1.tar.gz

5. After decompression, we use the cd command to enter the nginx-1.8.1 folder

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!

If you use nginx to access the content of the ftp site, you need to set the nginx user to the corresponding ftp user, otherwise a 403 error will be reported due to insufficient permissions


6. Start nginx

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

Second, online installation

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/

Online installation start nginx
/etc/init.d/nginx start

More nginx learning recommendations: http://www.nginx.cn

Recommended Posts

ubuntu install nginx server
Install OpenSSL 1.0.2 on Ubuntu Server 14.04
Install Nginx server on CentOS 7
How to install Nginx on Ubuntu 20.04
Install Chef server workstation on Ubuntu 18.04
How to install Nginx on Ubuntu 20.04
Install Ubuntu 18.04 server with kvm virtualization
How to install Nginx on Ubuntu 16.04
Install Oracle 11gR2 on Ubuntu Server 12.4.0
Centos7.3 install nginx
ubuntu18.04 install python2
ubuntu12.04 install python3
Ubuntu install guide
ubuntu install nodejs
ubuntu 16 install asp.net
ubuntu install leanote
ubuntu install Jenkins
docker install ubuntu
ubuntu install elasticsearch
Centos7 install Nginx
ubuntu16.0.1 install pagoda
ubuntu18.04 install python
ubuntu 18.04 install teamviewer
ubuntu install sendmail
Install Gnome and VNC on Ubuntu Server
How to install Bacula Server on Ubuntu 14.04
Configure Nginx Git server on Ubuntu system
Ubuntu install PHP and PHP Nginx configuration method
Install jetty in Ubuntu 18.04 Server, non-apt version
Ubuntu install ftp server and possible problems
How to install Zabbix on Ubuntu 16.04 Server
install vscode on ubuntu18
Install node.js under Ubuntu
Install mysql-pytho in Ubuntu
How to install Squid proxy server on Ubuntu 18.04
ubuntu install zsh terminal
Install Redis on Ubuntu
Install R4 on ubuntu20
Install nvtop on Ubuntu 18.04
Install postgresql-10 on Ubuntu 18.04
Install docker on Ubuntu
Ubuntu18.04 install opencv 3.2.0 solution
Install mysql under Ubuntu 16.04
Install Thrift under ubuntu 14.10
Install OpenJDK10 under Ubuntu
Install Caffe under Ubuntu 14.04
Install Docker on ubuntu18.04
Install nodejs10 on Ubuntu16
ubuntu install harbor warehouse
Install mysql on Ubuntu 14.04
Ubuntu16.04 install Mongodb tutorial
Install Django on ubuntu
Install Pytorch+CUDA on Ubuntu 16.04
2018-09-11 Install arduino under Ubuntu
Install Python3 on Ubuntu 14.04
Ubuntu18.04 install Asterisk16.10 + FreePBX15.0
Ubuntu19 install MySQL pit
ubuntu16.04 install node.js, npm
Install rJava on Ubuntu18
Install JDK10+ on Ubuntu
Install python in Ubuntu