Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure Nginx reverse proxy under Linux

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to configure Nginx reverse proxy under Linux, which is very detailed and has a certain reference value. Interested friends must read it!

The use of reverse proxy can not only prevent the external network from vicious attacks on the intranet server, cache to reduce the pressure on the server and access security control, but also carry out load balancing and assign user requests to multiple services.

1. Upgrade the system, uninstall Apache and release port 80

Yum update-yYum remove httpd-Y2, install EPEL repo

Rpm-Uvh http://mirror.ancl.hawaii.edu/linux/epel/6/i386/epel-release-6-8.noarch.rpmEPEL repo download address: https://fedoraproject.org/wiki/EPEL3, install Nginx, and set up

Install Nginx

Yum install nginx-y adjust Nginx configuration

Cd / etc/nginx/conf.dmv default.conf default.conf.disabled4, create Nginx reverse configuration file

Cd / etc/nginx/conf.dvi yourdomain.com paste the following:

Server {listen 80th serverSecretname yourdomain.com;access_log off;error_log off;location / {proxy_pass http:// needs to reverse the server IP/;proxy_redirect off;proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_max_temp_file_size 0th clientholders maxillogram bodyweights 10m clientships bodyweights bufferbacks size 128kth proxy connectbacks timeout 90 Proxy_send_timeout 90 is proxied to read through timeout 90 to proxies buffers 4k to proxies buffers 4 32k to proxies busybags buffers 64k;} and then save.

5. Set up a firewall to allow access to port 80

Iptables-I INPUT 5-m state-- state NEW-p tcp-- dport 80-j ACCEPTservice iptables saveservice iptables restart6, launch Nginx

Service nginx start above is all the contents of this article entitled "how to configure Nginx reverse proxy under Linux". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report