Installation steps of nginx Nginx] [linux environment

Before you begin, make sure gcc g ++ development library installed, the default has been installed.

centos platform build environment using the following command

 Installation make:

yum -y install gcc automake autoconf libtool make

  Install g ++:

yum install gcc gcc-c++

 The following started:

First, select the installation file directory

  You can select any directory, select cd / usr / local / src

cd /usr/local/src

Second, install the PCRE library

  ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ download the latest PCRE source package, use the following command to download and install compile PCRE package :( herein with reference to download the file version: pcre-8.37. tar.gz proven not find this version, if you want to download the latest version of open URL above article chooses pcre-8.39.tar.gz)

cd /usr/local/src
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz 
tar -zxvf pcre-8.37.tar.gz
cd pcre-8.34
./configure
make
make install

Third, install zlib library

  http://zlib.net/zlib-1.2.11.tar.gz download the latest source package zlib, use the following command to download and install zlib package compiled :( herein with reference to download the file version: zlib-1.2.8.tar.gz proven did not find this version, if you want to download the latest version of open URL above article chooses zlib-1.2.11.tar.gz)

cd /usr/local/src
 
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

Fourth, install openssl (not installed by default in some vps ssl)

cd /usr/local/src
wget https://www.openssl.org/source/openssl-1.0.1t.tar.gz
tar -zxvf openssl-1.0.1t.tar.gz

Fifth, install nginx

  Nginx generally have two versions, namely stable version and the development version, you can select one of these two versions depending on your purpose, the following is the detailed steps to install Nginx / usr / local under / nginx directory:

cd /usr/local/src
wget http://nginx.org/download/nginx-1.12.2.tar.gz
tar -zxvf nginx-1.12.2.tar.gz
cd nginx-1.1.10
./configure
make
make install

Note: this error may occur

Under centos

yum -y install openssl openssl-devel

Sixth, start nginx

  Because it may take up apeache port 80, the port apeache try not to modify, we chose to modify nginx port.

  linux modify the path /usr/local/nginx/conf/nginx.conf,Windows installation directory \ conf \ nginx.conf.

  Modify the port is 8090, localhost modify your server ip address. (Success is in sight !!)

Start nginx

netstat -ano | grep 80

If you can not find out the results of the previous step is ignored (it must start with sudo under ubuntu, or can only run in the foreground)

sudo /usr/local/nginx/nginx

Seven, nginx restart, shut down, start

start up

 Start code format: nginx installation directory address -c nginx profile address

E.g:

[root@LinuxServer sbin]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

stop

 nginx stops in three ways:

  • Stop calm

  1. Check the process ID

[root@LinuxServer ~]# ps -ef|grep nginx

  2, kill the process

[root@LinuxServer ~]# kill -QUIT 2072

    Quick Stop

    1. Check the process ID

[root@LinuxServer ~]# ps -ef|grep nginx

    2, kill the process

  [root@LinuxServer ~]# kill -TERM 2132
或 [root@LinuxServer ~]# kill -INT 2132

  • Forced to stop

[root@LinuxServer ~]# pkill -9 nginx
  • Restart

1. Verify nginx configuration file is correct

Method a: entering the installation directory nginx sbin, enter the command ./nginx -t

You should see the following nginx.conf syntax is ok

nginx.conf test is successful

Description configuration file correctly!

Method 2: Start a command preceded by -t -c

 

2, restart Nginx service

Method One: Go to nginx executable sbin directory, enter the command ./nginx -s reload  to

Method Two: nginx find the current process ID, and then enter the command: kill -HUP process ID realize restart nginx service

Eight, the final result:

9, the project file storage path

Put this file, create a folder into good.

 

Guess you like

Origin www.cnblogs.com/EveningWind/p/10967864.html