Install Nginx_server application under Ubuntu

In the past two days, I want to set up a tomcat cluster and sort out the installation of nginx by the way. Follow this tutorial to succeed.


1. The selected directory

I selected the /home directory under the root directory

2. Installation dependencies


All the following operations are performed in the /home directory 
Install openssl, choose the version yourself

2.1安装gcc apt-get  install  build-essential

2.2 Installation openssl
#download
wget https://www.openssl.org/source/openssl-1.1.0e.tar.gz#解压
tar zxvf openssl-1.1.0e.tar.gz
#进目录
cd openssl-1.1.0e/
#执行配置
./config
#安装
make & make install

2.3 Install zlib

wget https://downloads.sourceforge.net/project/libpng/zlib/1.2.11/zlib-1.2.11.tar.gz
tar zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11/
./configure
make & make install

2.4 Install pcre

wget https://ftp.pcre.org/pub/pcre/pcre-8.40.tar.gz
tar zxvf pcre-8.40.tar.gz
cd pcre-8.40/
./configure
make & make install

After performing the above operations, the dependencies are installed

3. Install nginx

Download nginx, available at http://nginx.org/en/download.html

cd /home
wget http://nginx.org/download/nginx-1.11.10.tar.gz
tar zxvf nginx-1.11.10.tar.gz

Enter the installation directory of the nginx package 
and then create an nginx installation directory, which I created under /home

cd /home
mkdir nginx

Return to the installation package directory and execute the configuration command

cd /home/nginx-1.11.10/

#Execute the following command to configure (note the following directory, which is the dependency package directory and the created nginx to-be-installed directory. For linux novice, remind that the "\" behind it is also indispensable.
At the same time, you can also not specify ./configure 后面的依赖和启动文件的路径 等等这些 如果没有指定 那么启动的路径是/usr/local/nginx/sbin下的nginx文件,运行就可以了(./nginx)
./configure \
--sbin-path=/home/nginx/nginx \
--conf-path=/home/nginx/nginx.conf \
--pid-path=/home/nginx/nginx.pid \
--with-http_ssl_module \
--with-pcre=/home/pcre-8.40 \
--with-zlib=/home/zlib-1.2.11 \
--with-openssl=/home/openssl-1.1.0e

#安装
make $ make install

Just execute it

4. Under test

Enter the installation directory and allow the following command to view

cd /home/nginx
./nginx

You can see the effect by directly accessing the IP of the machine.



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325416890&siteId=291194637