nginx installation and reverse proxy configuration in Linux

foreword

Check the firewall, check firewalld directly on the private server, and check the security group on the public cloud
Private cloud checking method
systemctl status firewalld

The method of closing the firewall
systemctl stop firewalld
Check the status of the firewall again after closing it. If it turns gray, the closing is successful.
This method will only take effect temporarily (the server restart will take effect). To close it permanently, please execute the following command
systemctl disable firewalld

In addition to the above operations in the public cloud, you need to go to the public cloud workbench to release the port. Here is an example of Tencent Cloud.
Enter the example console and click on the firewall. Other manufacturers have a security group

Then add rules, which ports need to be released depends on business needs. For example, if my tomcat needs to run on port 8080, I will allow 8080. If I have an nginx server that needs to listen on port 80, then I will allow port 80.

deploy nginx

yum install

yum install nginx -y


If there is no software package, please change the epel download source, and Baidu for details.
After the installation is complete, check the status and start nginx

systemctl status nginx
systemctl start nginx//启动命令

Browser access ip+80

Configure port forwarding

The port mapping function is suitable for mapping of local services

Find the conf file of nginx, usually nginx.conf in the conf folder under the installation directory


The 8080 port of the proxy local service is like this

proxy_pass http://localhost:8080;

After saving, you need to restart the nginx service

Article source: nginx installation and reverse proxy configuration in Linux - ycyaw.com

Guess you like

Origin blog.csdn.net/qq_22163803/article/details/130707187