Install Nginx static resource server on Linux

1. Download dependencies

yum -y install pcre*

yum -y install openssl*

2. Download wget (similar to Thunder, used to download files)

yum install wget

3. Download Nginx


wget http://nginx.org/download/nginx-1.21.1.tar.gz

4. Unzip

tar zxvf nginx-1.21.1.tar.gz

5. Enter the directory after decompression, compile

 

./configure

6. Install after compiling

make install

7. Check whether the installation is complete

After the installation is complete, an Nginx directory will be generated in the same level directory, which is our server directory

 

8. Start

After installation, go to the Nginx directory to start

cd sbin

./nginx

9. If the startup fails, an error will be reported: nginx: [emerg] still could not bind()

Solution : You can check whether the port number is occupied, kill the corresponding port number, and then start

1) Check the port number :

 netstat -ntlp|grep 80

 From the above inspection, it can be seen that the port number 80 is occupied, you can kill this process and start it again

2) Kill the port number :

kill -9 端口号

3) Reboot :

./nginx

10. Check whether the startup is successful

Find your own server address, open it in the browser, if you see Welcome to nginx! 

Then congratulations, the installation has been successful!

 

Guess you like

Origin blog.csdn.net/qinqinzqq/article/details/124798066