Setting Up Web Services on Home NAS with Cloud Hosting and Intranet Penetration

Introduction

I have long wondered if it is possible to set up web services on my home NAS and achieve external access. However, most home broadband connections do not have a public IP, and ports 80 and 443 are generally blocked. At that time, I was not very proficient in network technology, so I purchased a cloud server to build my website, and I did not delve deeper into this idea. But recently, some issues I encountered while maintaining the website reminded me of that idea. After researching and going through some setbacks, I finally achieved the functionality mentioned above.

Problems and Solutions

Problems

As mentioned earlier, I encountered some problems while maintaining the website, mainly reflected in:

  • Cloud servers from major providers like Tencent Cloud and Alibaba Cloud are generally expensive and have low configurations; I have always used a 1H2G server.

  • After using the combination of 1panel and halo, I found it consumes a lot of system resources, with daily memory usage often hovering around 70%, causing the server to frequently crash.

  • If I upgrade the server configuration, the costs become particularly high, which is unaffordable for personal site owners who do not profit from their websites.

Solution

Thus, the solution mentioned in this article was born: cloud hosting + intranet server + intranet penetration to set up web services and enable external access.

Required software, hardware, and applications:

  1. Cloud hosting: No need for high specifications; 2H2G is sufficient, which is basically the lowest configuration for current cloud hosting.

  2. Home server: NAS or an old computer will do; I use a NAS.

  3. 1panel: This panel needs to be installed on both the cloud hosting and home server to achieve fully visual installation, which is very user-friendly for someone like me who does not understand code.

  4. Frp application: Frp is an intranet penetration software consisting of a server (frps) and a client (frpc).

This article assumes you have prepared the above items 1-3, so I won’t elaborate on them. The focus will be on the installation and configuration of Frp (item 4), as I have encountered several failures due to incorrect frp configuration.

Starting Deployment

Frp Server

Install the frp server on the cloud hosting

  1. Go to 1panelApp Store – search for frpfrp server, click install Setting Up Web Services on Home NAS with Cloud Hosting and Intranet Penetration

  2. Modify the default values for “Service Port”, “Dashboard Port”, “Password”, and “Key”, mainly modifying the service port and key; the password is auto-generated, and the others can remain default. Setting Up Web Services on Home NAS with Cloud Hosting and Intranet Penetration

  3. After modification, click confirm to complete the installation; you can see that frps has started on the installed applications page. Setting Up Web Services on Home NAS with Cloud Hosting and Intranet Penetration

Note: Generally, cloud hosting is configured with security groups and firewalls; you need to open TCP ports in the provider’s backend, specifically the “Service Port” filled in step 2.

Frp Client

Install the frp client on the home server

  1. Repeat steps 1 and 2 above, but this time select “frp client”. Here, fill in the “Service Server IP” with the external IP address of the cloud hosting, and fill in the “Service Port” and “Key” with the “Service Port” and “Key” from step 2, ensuring they match. The others can remain default. Setting Up Web Services on Home NAS with Cloud Hosting and Intranet Penetration

  2. In the browser, enter: home server IP + Dashboard port, for example, “192.168.1.2:7400”, hit enter, and a dialog box will pop up. Enter the “Username” and “Password” set for the client to access the frp settings panel.

  3. Select “Configure” in the settings panel, where you can see the service IP, port, key, and other information set above. You do not need to worry about it. The configuration information in the red box at the bottom of the image needs to be added by yourself, which is the key part. Setting Up Web Services on Home NAS with Cloud Hosting and Intranet Penetration

  4. After configuration, still on this page, click “upload”; after a successful prompt, go to “Overview”, and it will display the following information; if “status” shows “running”, it means success. Setting Up Web Services on Home NAS with Cloud Hosting and Intranet Penetration

[[proxies]]
# Tunnel name, customizable, cannot be duplicated
name = "web_nas_http"
# Tunnel type, can be tcp, udp, http, https, tcpmux, stcp, sudp, xtcp
type = "tcp"
# Local IP address, if it is local, then 127.0.0.1
localIP = "127.0.0.1"
# Local port, local service port
localPort = 80
# Remote port, the port used to connect the tunnel
remotePort = 8019

[[proxies]]
name = "web_nas_https"
type = "tcp"
localIP = "127.0.0.1"
localPort = 443
remotePort = 4432

Similarly, on the server panel, you can also see the relevant information; if the status shows “online”, it means that the installation and configuration of frp are complete.

Setting Up Web Services on Home NAS with Cloud Hosting and Intranet Penetration
672a218d299cc.webp

Other Settings

After the crucial intranet penetration frp installation is complete, to ensure normal website access, additional related settings are required.

Cloud Hosting Side

  1. After entering the 1panel, select WebsiteWebsite on the left side, and click the Create Website button. Setting Up Web Services on Home NAS with Cloud Hosting and Intranet Penetration

  2. Select Reverse Proxy, fill in the domain name for accessing the website in the Main Domain, and fill in the proxy address as Local IP Address + Remote Port Number, for example: 127.0.0.1:8019, select http in front, and click confirm after setting. Setting Up Web Services on Home NAS with Cloud Hosting and Intranet Penetration

  3. The above settings are for HTTP access; most websites now use HTTPS for access. You can refer to step 2 to set up HTTPS, just select https in front of the proxy address and change the IP port to the corresponding remote port number. As for applying and setting up the SSL certificate, it is beyond the scope of this article and will not be elaborated on here.

Home Server Side

  1. Refer to step 1 above, enter the 1panel, select WebsiteWebsite on the left side, and click the Create Website button.

  2. Here, it is similar to our usual website installation and settings. You can choose one-click deployment, runtime environment, static website, etc., and fill in the domain name set on the cloud hosting in the Main Domain, click confirm after setting. Setting Up Web Services on Home NAS with Cloud Hosting and Intranet Penetration

Conclusion

  • With the above settings, our website can be accessed normally. The benefits of this setup are:

  • The website business is deployed locally, and the cloud hosting only serves as a redirect, so there is no need to worry about data loss if the cloud hosting goes down.

  • The local server configuration can be freely chosen, whether it is an old computer or a specially configured new computer, with hardware easily at 8H16G, allowing for various experiments.

  • The cloud hosting does not run website business, so you only need to purchase the most basic configuration and choose enough bandwidth, saving costs.

If there are any unclear points, or if there are deficiencies or errors, feel free to discuss them in the comments section.

Leave a Comment

×