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

Nginx reverse proxy apache and Nginx

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

one。 Agent apahce:

1. Configure the nginx profile first:

[root@centos7 conf.d] # vim / opt/app/nginx/conf.d/wordpress.conf

Server {

Listen 80

Server_name localhost

Location / {

Proxy_pass http://192.168.1.204;

Proxy_set_header X-Real-IP $remote_addr

}

}

two。 If apache needs to see that the client is really IP, you need to modify the configuration file.

Vim / etc/httpd/conf/httpd.conf

LogFormat "% {X-Real-IP} I% l% u% t\"% r\ "% > s% b\"% {Referer} I\ "\"% {User-Agent} I\ ""

Change the original% h to {X-Real-IP} I, where the client accesses IP in the log.

2. Nginx.

It is simple and convenient. In-depth need to see the official documentation.

[root@centos7 conf.d] # cat / opt/app/nginx/conf.d/wordpress.conf

Server {

Listen 80

Server_name localhost

Location / {

Proxy_pass http://192.168.1.204;

Proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for

}

}

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

Servers

Wechat

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

12
Report