1. Enter the official website to download Nginx resources:
Official website download: http://nginx.org/en/download.html
2. Resource download (because it is installed on Linux, so I downloaded the resource package for Linux installation, you can choose the version you want)
3. After downloading the resources, upload them to Linux (the location is optional, I uploaded it to /home/myqxin/java)
4. Unzip the resources and enter the unzipped directory.
Unzip command
# 解压到当前目录下
tar -zxvf 资源包
Screenshot below:
5. Configure basic information, the command is as follows
#配置configure --prefix 代表安装的路径,--with-http_ssl_module 安装ssl,--with-http_stub_status_module查看nginx的客户端状态
./configure --prefix=/usr/local/nginx-1.20.2 --with-http_ssl_module --with-http_stub_status_module
The execution is completed as follows (there are too many processes and the interception is incomplete. Only the input command and the end effect are intercepted)
Then you can see that there is an additional Makefile file in our directory
If the following problems occur when you execute
- Problem 1:
Solution 1, enter the following command
yum -y install gcc gcc-c++ autoconf automake make
This process needs to wait for some time. The execution is completed as follows (there are too many processes and the interception is incomplete. Only the input command and the end effect are intercepted)
- Problem 2:
Solution 2: Enter the following command
yum -y install openssl openssl-devel
This process needs to wait for some time. The execution is completed as follows (there are too many processes and the interception is incomplete. Only the input command and the end effect are intercepted)
6. Compile and install
#编译安装nginx
make & make install
This process needs to wait for some time. The execution is completed as follows (there are too many processes and the interception is incomplete. Only the input command and the end effect are intercepted)
7. Enter the directory after installation (in step 5, we configured the installation location)
8. Enter the sbin directory and execute the command to start
./nginx
9. Visit ip:80
I didn't configure port 80 here, so I just turned off the firewall here.
10. If you cannot access it, it may be a firewall problem.
添加 --permanent永久生效,没有此参数重启后失效 这里的6379为redis服务的端口,若为其他服务设置,需要对应端口
firewall-cmd --zone=public --add-port=6379/tcp --permanent
重新载入
firewall-cmd --reload
查看所有打开的端口:
firewall-cmd --zone=public --list-ports
防火墙的关闭:
systemctl stop firewalld //一般不用
防火墙的启动:
systemctl start firewalld