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 forward proxy configuration under CentOS 6

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Nginx forward proxy configuration under CentOS 6

By: Lao Ning

I. introduction of the environment

1. Client as an Internet PC terminal that needs access.

Nic address: 192.168.1.200

2. Nginx Server acts as the Internet export proxy server.

Intranet card: 192.168.1.100

External network card: 10.10.16.186

Second, configuration introduction

1. Nginx Server configuration:

[root@localhost] # cat / usr/local/nginx/nginx.conf

Server {

Listen 80; # listening on port 80

The content address of server_name 192.168.1.100; # Server, which is interconnected with the Client address

Resolver 8.8.8.8; # DNS

Location / {

Proxy_pass http://$http_host$request_uri; # $http_host and $request_uri are nginx system variables that do not need to be replaced and remain intact

}

}

2. Client configuration:

[root@localhost ~] # export http_proxy= http://192.168.1.100:80 # set the variable environment and specify the proxy server IP address and port

Test:

[root@localhost ~] # wgetwww.baidu.com # can successfully visit Baidu

-- 2017-10-17 13 08RV 15muri-http://www.baidu.com/

Connecting 192.168.1.100RV 80... Connected.

A Proxy request has been issued and is waiting for a response. 200 OK

Length: [text/html] not specified

Saving to: "index.html.1"

[] 99762--.-K in s 0.07s

2017-10-17 13:08:16 (1.36 MB/s)-"index.html.1" saved [99762]

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