search
HomeOperation and MaintenanceNginxHow to configure nginx to ensure that the frps server and web share port 80

First of all, you will have a doubt, what is frp? Simply put, frp is an intranet penetration tool. After configuring the client, you can access the intranet through the server.

Now my server has been built with nginx, and there is only one port 80. So what should I do if the frp server also wants to use port 80?

After querying, this can be achieved by using nginx's reverse proxy.

To add: frps is the server (server), frpc is the client (client).

Step one: Modify the nginx.conf configuration file in the server

Add the following parameters in 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 below, save the settings and restart nginx

How to configure nginx to ensure that the frps server and web share port 80

Step 2: Modify the frp server configuration file

Since the reverse proxy has reached port 8080, the configuration file of the frp server also needs to be set

vhost_http_port = port 8080 in the frps.ini configuration file

How to configure nginx to ensure that the frps server and web share port 80

The third step: Modify the frp client configuration file

The first step is configuring: server_name xiaoyue.ml www.xiaoyue.ml; Fill in the corresponding domain name here.

also supports pan-parsing, for example: server_name *.xiaoyue.ml; the domain name needs to be pan-parsed at the same time.

So how to modify frpc.ini, it’s very simple

Configure the corresponding domain name in the corresponding penetration service configuration, custom_domains = xiaoyue.ml

How to configure nginx to ensure that the frps server and web share port 80

Step 4:

Restart frps on the server, start frpc on the local computer, and you can pass 80 in the browser The port directly accesses xiaoyue.ml.

How to configure nginx to ensure that the frps server and web share port 80

Additional 1:

xiaoyue.ml is parsed to my server, and this website is built in the LAN in my own computer.

That is to say, first make sure that you access 127.0.0.1 on your computer and there is content.

Additional 2:

The reverse proxy in the first step can also be done like this

Pagoda background

1) Website -->Add a site, enter your domain name

For example, enter the added domain name xiaoyue.ml Submit

2) Click Settings-->Reverse proxy

Target Fill in http://127.0.0.1:8080 in the url, please do not enter the wrong

Choose to enable reverse proxy

ps: Are you a little confused? . .

In fact, the core of this article is just one step, which is to reverse proxy to xiaoyue.ml:8080 port when you visit xiaoyue.ml (by default, we access the website through port 80).

Then what’s the point of doing this? I just want to access the website directly through the domain name instead of accessing the website through the domain name:port number.

The above is the detailed content of How to configure nginx to ensure that the frps server and web share port 80. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:亿速云. If there is any infringement, please contact admin@php.cn delete
Using NGINX: Optimizing Website Performance and ReliabilityUsing NGINX: Optimizing Website Performance and ReliabilityMay 09, 2025 am 12:19 AM

NGINX can improve website performance and reliability by: 1. Process static content as a web server; 2. forward requests as a reverse proxy server; 3. allocate requests as a load balancer; 4. Reduce backend pressure as a cache server. NGINX can significantly improve website performance through configuration optimizations such as enabling Gzip compression and adjusting connection pooling.

NGINX's Purpose: Serving Web Content and MoreNGINX's Purpose: Serving Web Content and MoreMay 08, 2025 am 12:07 AM

NGINXserveswebcontentandactsasareverseproxy,loadbalancer,andmore.1)ItefficientlyservesstaticcontentlikeHTMLandimages.2)Itfunctionsasareverseproxyandloadbalancer,distributingtrafficacrossservers.3)NGINXenhancesperformancethroughcaching.4)Itofferssecur

NGINX Unit: Streamlining Application DeploymentNGINX Unit: Streamlining Application DeploymentMay 07, 2025 am 12:08 AM

NGINXUnit simplifies application deployment with dynamic configuration and multilingual support. 1) Dynamic configuration can be modified without restarting the server. 2) Supports multiple programming languages, such as Python, PHP, and Java. 3) Adopt asynchronous non-blocking I/O model to improve high concurrency processing performance.

NGINX's Impact: Web Servers and BeyondNGINX's Impact: Web Servers and BeyondMay 06, 2025 am 12:05 AM

NGINX initially solved the C10K problem and has now developed into an all-rounder who handles load balancing, reverse proxying and API gateways. 1) It is well-known for event-driven and non-blocking architectures and is suitable for high concurrency. 2) NGINX can be used as an HTTP and reverse proxy server, supporting IMAP/POP3. 3) Its working principle is based on event-driven and asynchronous I/O models, improving performance. 4) Basic usage includes configuring virtual hosts and load balancing, and advanced usage involves complex load balancing and caching strategies. 5) Common errors include configuration syntax errors and permission issues, and debugging skills include using nginx-t command and stub_status module. 6) Performance optimization suggestions include adjusting worker parameters, using gzip compression and

Nginx Troubleshooting: Diagnosing and Resolving Common ErrorsNginx Troubleshooting: Diagnosing and Resolving Common ErrorsMay 05, 2025 am 12:09 AM

Diagnosis and solutions for common errors of Nginx include: 1. View log files, 2. Adjust configuration files, 3. Optimize performance. By analyzing logs, adjusting timeout settings and optimizing cache and load balancing, errors such as 404, 502, 504 can be effectively resolved to improve website stability and performance.

Deploying Applications with NGINX Unit: A GuideDeploying Applications with NGINX Unit: A GuideMay 04, 2025 am 12:03 AM

NGINXUnitischosenfordeployingapplicationsduetoitsflexibility,easeofuse,andabilitytohandledynamicapplications.1)ItsupportsmultipleprogramminglanguageslikePython,PHP,Node.js,andJava.2)Itallowsdynamicreconfigurationwithoutdowntime.3)ItusesJSONforconfigu

NGINX and Web Hosting: Serving Files and Managing TrafficNGINX and Web Hosting: Serving Files and Managing TrafficMay 03, 2025 am 12:14 AM

NGINX can be used to serve files and manage traffic. 1) Configure NGINX service static files: define the listening port and file directory. 2) Implement load balancing and traffic management: Use upstream module and cache policies to optimize performance.

NGINX vs. Apache: Comparing Web Server TechnologiesNGINX vs. Apache: Comparing Web Server TechnologiesMay 02, 2025 am 12:08 AM

NGINX is suitable for handling high concurrency and static content, while Apache is suitable for dynamic content and complex URL rewrites. 1.NGINX adopts an event-driven model, suitable for high concurrency. 2. Apache uses process or thread model, which is suitable for dynamic content. 3. NGINX configuration is simple, Apache configuration is complex but more flexible.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment