Author: 33 chongtian
Through the process of learning and sharing, summarize and output the problems and technologies in their work, hoping that both rookies and veteran can gain new knowledge through their own articles and put them into practice.
Once there is a lazy way to do anything, it is absolutely to choose the most lazy way to do it. My installation of tool software also follows this principle. There are many installation guides for nginx on the Internet, which can be divided into two types, one is source code installation, the other is Yum installation.
I prefer the yum installation method, because you can be lazy, a few commands to get things done, the whole is so complex, what to do. Next, I will write a guide document on how to install nginx using yum, and record and share the problems in the installation process, so as to avoid everyone stepping on the pit.
1. Add source
By default, there is no source for nginx in centos7. Recently, we found that the source address of CentOS is provided on the official website of nginx. Therefore, you can execute the following command to add the source:
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
2. Install nginx
yum search nginxSee if the source has been added successfully. If successful, execute the following command to install nginx.
yum install -y nginx
3. Start nginx and set it to run automatically
sudo systemctl start nginx sudo systemctl enable nginx
4. Browse to see the effect
Browser input: 127.0.0.1, when you see the content shown next week, it means the installation is successful.
5. Other configuration items
1. Modify nginx service initiator
Find user nginx in the first 10 lines; Change to user root;
The purpose of this step is to enable the nginx service to have root permissions, because sometimes the 403 error code will appear
Common commands of nginx
Check whether the configuration file is correct, and execute the command to view after each modification of nginx configuration.
nginx -s reload
You must be very familiar with this command. Restart nginx service.
Welcome to the official account toolkit, dedicated to sharing outstanding open source projects, learning resources and tools.
Reply to the keyword “pay attention to the gift package”, send you a complete skill map of programmers.
Reply to the keyword “Wx”, add personal wechat, hook up with the author, welcome to chat–。