Reverse Proxy a Web Website
In ServBay, you can use the reverse proxy feature to forward a website from another internal server to your local machine, making it easier to conduct development and debugging tasks. This document will provide a detailed guide on setting up a reverse proxy in ServBay, and illustrate how to proxy a site from an internal server to your local environment.
Overview
A reverse proxy is a server that receives client requests from one or more servers and forwards them to the respective servers. Reverse proxies are very useful in development and debugging as they allow internal server websites to be proxied to a local environment, simplifying access and testing.
Steps to Add a Reverse Proxy Website
Step 1: Prepare the Internal Server
Ensure the website on the internal server is running normally and accessible via the internal IP address and port. For example, suppose the internal server's IP address is 192.168.1.100
, and the website operates on port 8080
.
Step 2: Open the ServBay Management Interface
Locate ServBay
in the application and double-click to open it.
Step 3: Navigate to Host Management
Once open, you will see the main interface of ServBay. In the left navigation menu, click Host
. This will take you to the website management page.
Step 4: Add a New Website
On the website management page, click the +
button at the bottom of the page. This opens a new form on the right to enter basic information for the new website.
Step 5: Configure Reverse Proxy Settings
On the page for adding a website, you need to fill in the following information:
- Name: The website's name, for identification purposes.
- Domain: Enter the domain name of the site you're adding, such as
proxy.to.local
. - Protocol: The protocol supported by the website, default is HTTP/HTTPS.
- SSL Certificate Request Method: It is recommended to select
ServBay CA
, which will automatically generate and manage the SSL certificate by ServBay. - Website Type: Select
Reverse Proxy
, specifying that the website accesses internal servers via the reverse proxy. - Proxy Target: Enter the internal server's IP address and port, such as
192.168.1.100
and8080
.
Step 6: Complete and Save
After filling in all necessary information, click the Add
button. ServBay will automatically create the configuration for the new website and make the respective settings on the host.
Once saved successfully, you can click the browser icon in the top-right corner to access the website.
Step 7: Quick Actions
ServBay provides a series of quick action buttons for the website, including:
- Open the website in an IDE for quick editing
- Open the website in a browser
- View website logs
- Pause, start the website
- Delete the website
Common Issues and Solutions
Website Not Accessible
- Check Domain Resolution: Ensure the domain is correctly pointing to the ServBay server's IP address.
- Check Firewall Settings: Ensure the firewall permits external access to the ServBay server's ports (typically ports 80 and 443).
- View Error Logs: Check the error log files of the reverse proxy to identify specific errors and perform corresponding fixes.
Internal Server Not Accessible
- Ensure Internal Server is Running Normally: Before adding a reverse proxy, ensure the website on the internal server is running normally and accessible via the internal IP address and port.
- Check Network Connection: Ensure the network connection between the ServBay server and the internal server is normal, with no network isolation or firewall rules blocking access.
Summary
Setting up a reverse proxy in ServBay is a simple and intuitive process. By using a reverse proxy, you can proxy websites from an internal server to a local environment, simplifying development and debugging tasks. Just follow the steps outlined above to easily add and configure a reverse proxy website. With appropriate configuration and management, you can ensure the website operates stably in the ServBay environment. If issues arise, refer to the common issues and solutions for troubleshooting and resolving them.