Adding a Docker-Service Hosted Website
In ServBay, you can run and manage websites using Docker containers. This method is not only flexible but also easy to maintain and expand. This article will explain in detail how to add a website hosted by Docker services in ServBay, including the steps, considerations, and solutions to common problems.
Overview
ServBay offers a user-friendly interface, making it very simple to add and manage Docker-hosted websites. By following the steps below, you can easily add a Docker-service website in ServBay and configure related settings to ensure the website operates smoothly.
Steps to Add a Website
Step 1: Prepare the Docker Container
First, ensure Docker is installed and running on your server. Then, create and run a Docker container to host your website. For example, use the following command to run a simple Nginx container:
docker run -d --name my-nginx -p 8080:80 nginx
In this example, the Nginx container will listen on port 8080 of the server.
Step 2: Open the ServBay Management Interface
Locate ServBay
in the application, and double-click to open.
Step 3: Navigate to Host Management
After opening the program, you will see the main interface of ServBay. Click Host
in the navigation menu on the left to enter 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 will open a new form on the right to enter the basic information for the new website.
Step 5: Configure Website Settings
On the page for adding a website, you need to fill in the following information:
- Name: The name of the website for identification.
- Domain: Enter the domain for the website you want to add, e.g.,
docker.demo
. - Protocol: The protocols the website supports, default is HTTP/HTTPS.
- SSL Certificate Request Method: It is recommended to choose
ServBay CA
, which will automatically generate and manage SSL certificates through ServBay. - Website Type: Select
Reverse Proxy
, specifying that the website is accessed via reverse proxy to the Docker container. - IP Address: Enter
127.0.0.1
. - Port: Enter the port the Docker container listens on, e.g.,
8080
.
Step 6: Complete and Save
After filling in all the necessary information, click the Add
button. ServBay will automatically create the new website configuration and make the necessary settings on the host.
Once saved successfully, you can click the browser icon in the top-right corner to visit the website.
Step 7: Quick Actions
ServBay offers a series of quick action buttons for websites, including:
- Open the website in IDE for quick editing
- Open the website in browser
- View website logs
- Pause/Activate the website
- Delete the website
Summary
Adding a Docker-service hosted website in ServBay is a simple and intuitive process. With Docker containers, you can flexibly manage and expand your website. By following the steps above, you can easily add and configure a new website. Through proper configuration and management, you can ensure your website runs stably in the ServBay environment. If any issues are encountered, you can refer to the common problems and solutions for troubleshooting and fixing.