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 to ensure that the frps server shares port 80 with web

2025-03-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the knowledge of "how to configure nginx to ensure that the frps server and web share port 80". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

First of all, you will have a question: what is frp? To put it simply, frp is an intranet penetration tool. After configuring the client, you can access the intranet through the server.

Now my server has used nginx as a station, there is only one port 80, so if the server of frp also wants to use port 80, what should I do?

After query, this can be achieved, that is, using the reverse proxy of nginx to achieve.

Add: frps is the server and frpc is the client.

Step 1: modify the nginx.conf configuration file in the server

Add the following parameters to http {} in nginx.conf

Server {listen 80; server_name xiaoyue.ml www.xiaoyue.ml; location / {proxy_pass http://127.0.0.1:8080; proxy_redirect http://$host/ http://$http_host/; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header host $host;}}

As shown in the following figure, save and restart nginx after setting it.

Step 2: modify the frp server configuration file

Now that the reverse proxy is on port 8080, the configuration file on the frp server also needs to be set.

Vhost_http_port = port 8080 in frps.ini configuration file

Step 3: modify the frp client profile

Step 1: enter the corresponding domain name here in server_name xiaoyue.ml www.xiaoyue.ml;.

Universal resolution is also supported, such as server_name * .xiaoyue.ml. Domain name is required to perform universal resolution at the same time.

So how to modify frpc.ini? it's very simple.

The corresponding domain name is configured in the corresponding traversal service configuration, custom_domains = xiaoyue.ml

Step 4:

Restart frps in the server, start frpc in the local computer, and you can access xiaoyue.ml directly through port 80 in the browser.

Add 1:

Xiaoyue.ml is parsed to my server, and this site is built on my own computer in the local area network.

That is, first of all, make sure that you visit 127.0.0.1 on your computer, which is full of content.

Add 2:

The reverse proxy in the first step can do the same.

Pagoda backstage

1) website-- > add site, enter your domain name

For example, enter the added domain name xiaoyue.ml to submit

2) Click Settings-> reverse proxy

Enter http://127.0.0.1:8080 in the target url. Do not enter an error.

Select to enable reverse proxy

Ps: are you a little confused?

In fact, the core of this article is only one step, that is, for example, you access xiaoyue.ml (by default, we visit the website is port 80), reverse proxy to the xiaoyue.ml:8080 port.

So what's the point of doing this, that is, you want to access the website directly through the domain name, not through the domain name: Port number.

This is the end of the introduction of "how to configure nginx to ensure that the frps server shares port 80 with web". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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

Internet Technology

Wechat

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

12
Report