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 configuration reverse proxy

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

Share

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

1. Introduction

One of the most common functions of Nginx is to configure reverse proxies. Configuration is also very simple, only need to use the proxy module.

How to view the default installation module of nginx?

There is an auto directory under the nginx installation directory and then you can view it using the command below.

Cat auto/options | grep YES

Intercepting some of them are modules installed by nginx.

2. Nginx reverse proxy configuration

The following is the easiest configuration to configure nginx as a reverse proxy

It can also be configured in nginx.conf or with virtual hosts in vhosts.

Server {

Listen 80

# configure the port number for listening

Server_name 192.168.8.3

# configure the IP of nginx, or the domain name to be accessed

Location / {

Proxy_pass http://192.168.8.2:8080;

# configure the access address that needs to be proxied, both domain name and IP

Index index.html index.htm index.php

}

}

The above is the simplest configuration, nothing else is configured. There is no configuration for logs and so on.

The most critical field for configuring reverse proxies is the proxy_pass field.

Format: proxy_pass URL

URL is an IP address or a domain name. The premise is that the server of the agent can access the proxied server at the back end.

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