Centos8 builds basic configuration of nginx server

Foreword:

Because I need to build my "Kudoyun" (a cloud service, a semi-free php service for cloud computers), the configuration on the official website requires a nginx server. It was built using Apache before, but it didn’t feel very stable. I decided today Try it with the nginx server. I heard that nginx was developed by a Russian boss, and the Russian stuff is also quack!

It is the first time to build an nginx server, the whole process is a groping build! Take it as a note, write it in the blog, and share it with everyone!

Download nginx:

yum install nginx -y //下载nginx

View the service status of nginx:

systemctl status nginx.service //查看状态

Start the nginx server:

systemctl start nginx.service //启动nginx 服务器

Check the status again:

systemctl status nginx.service 

Found that it has been started. ( If an error message appears, it may be that the port server is occupied. If you have installed other servers when installing the nginx server, you should modify the occupied port )

vi nginx.conf.default //修改端口.对应的目录文件是在/etc/nginx下的

The port modification methods of different versions may be different.After setting the port, you must restart the nginx service.

Set boot up automatically:

systemctl enable nginx.service 

 

The things to note here are:

The firewall needs to be turned off ( at first I thought it was because my network was blocked, but when I installed other servers in the experiment, I only turned off the firewall to access, so I decided to turn off the firewall and try it, and the result was just as I thought )

systemctl stop firewalld.service //关闭防火墙指令

Whether access to nginx is installed successfully:

Enter in the browser, the ip address of the test machine

or:

 curl http://192.168.20.51 //本机ip

Check the version of nginx:

nginx -v //查看版本

Uninstall nginx:

yum remove nginx //卸载

Summary: The whole process is built using yum source, which saves a lot of the trouble of relying on packages compared to wget downloading.

Guess you like

Origin blog.csdn.net/qq_43575090/article/details/107058584