Nginx startup and successful installation page

The official website of the free and open source version: add a link to describe
Nginx has a Windows version and a Linux version, but it is more recommended to use Nginx under Linux;
preparations before installation The installation of Nginx needs to determine several libraries related to Linux installation, otherwise configuration and compilation will appear errors, the specific check installation process is:
(. 1) GCC compiler is installed
to check whether the installation: yum list installed | grep gcc
the installation: yum install gcc -y
(2) OpenSSL libraries have been installed
to check whether the installation: yum list installed | grep openssl
the installation: yum install openssl openssl-devel -y
(. 3) PCRE libraries have been installed
to check whether the installation: yum list installed | grep pcre
Executive installation: yum install pcre pcre-devel -y
(4) zlib library is installed
check whether the installation: yum list installed | grep zlib
the installation: yum install zlib zlib-devel -y
is not that can trouble the following solution coming! ! !
One-time installation, execute the following command

 yum install gcc openssl openssl-devel pcre pcre-devel zlib zlib-devel -y

Ø Unzip the downloaded nginx file and execute the command: tar -zxvf nginx-1.14.2.tar.gz
Ø Switch to the decompressed nginx home directory and execute the command: cd nginx-1.14.2
Ø In the nginx home directory nginx-1.14 .2 Execute the command: ./configure --prefix=/usr/local/nginx
Ø (where -prefix is ​​the specified nginx installation path) Note: Do not have spaces around the equal sign
Ø Execute command to compile: make
Ø Execute command to install : After the make install installation is successful, you can switch to the /usr/local/nginx directory and view the content to
start
1. Ordinary startup
Switch to the sbin directory of the nginx installation directory and execute: ./nginx
2. Configuration file
startup./nginx- c /usr/local/nginx/conf/nginx.conf/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf where -c is the specified configuration file, and the configuration file path must Specify the absolute path to
check whether the startup is successful

ps -ef | grep nginx

Insert picture description here
Check if your own
startup is successful After startup, check if you can log in to nginx and enter 192.168.192.131 under xshel.
Insert picture description here
Everyone's is different. Don't follow your tutorial, it will be wrong! ! !
Insert picture description here

This is success! !
Of course, it may be unsuccessful. The following is the problem I encountered: I can't
access it.

firewall-cmd --list-all 

Check your open ports. Insert picture description here
If there is no port, you can add it yourself.
Insert picture description here
You can change it to what you want. If you don’t have a port open, add 8080 after port=
and enter the following command to reload it

firewall-cmd --reload

Here is the big trick:
systemctl status firewalld View the current firewall status.
systemctl stop firewalld closes the current firewall.
systemctl disable firewalld The firewall does not start after booting.
Just execute the first two statements. I don’t know how to fix the rest. After executing the firewall, you can turn off the firewall and visit it! !

Guess you like

Origin blog.csdn.net/qq_42678668/article/details/108456444