How to Switch the Default Web Server in ServBay
ServBay is a powerful local web development environment that comes with built-in support for three major web servers: Caddy, NGINX, and Apache. Developers can easily switch between these servers as the default, based on project requirements or personal preferences.
Important Note
Currently, ServBay only supports one web server running at a time. Once you set a web server as default, the other web servers will automatically stop and be disabled.
For example, if you set NGINX
as the default web server, both Caddy
and Apache
will be automatically disabled and cannot be separately enabled in the “Packages” list.
Overview
ServBay integrates Caddy
, NGINX
, and Apache
, giving you the flexibility to choose your preferred web server. You can switch between them at any time to suit different development or testing scenarios.
One of ServBay’s key features is its intelligent configuration management. When switching the default web server, ServBay automatically converts and generates the corresponding configuration files (for example, converting a Caddy configuration to NGINX or Apache format), saving you from the hassle of manual editing or migration.
Your choice of web server often depends on:
- Project requirements: Some frameworks or applications may better support or recommend specific web servers.
- Performance considerations: Different servers may offer varied performance under certain loads.
- Personal familiarity: You may be more comfortable with the configuration and features of a particular server.
Notes on Custom Site Configurations
If any of your sites use custom configuration files for a specific web server (for example, you manually created an NGINX config snippet for the servbay.demo
site), then ServBay cannot automatically convert these custom configurations to formats for other servers (like Caddy or Apache) when changing the default web server.
This means that if the servbay.demo
site uses a custom NGINX configuration, it can only function with NGINX. The site will no longer work as expected after switching the default web server to Caddy or Apache.
When you attempt to switch the default web server, ServBay will detect such custom configurations and display a warning. You’ll need to manually modify or remove these custom settings to ensure your site works with the new default web server.
Prerequisite: Installing the Required Web Server
Before setting a certain web server as default, make sure it is installed in ServBay.
Caddy: The Caddy service is included in ServBay Runtime and is available by default, with no extra installation required.
NGINX: If you want to set NGINX as the default server, you’ll need to install it first. Open the ServBay app, navigate to “Packages” -> “General Packages”. Find
NGINX
in the list and click the green install button on the right to install.Apache: If you want to set Apache as the default server, you’ll need to install it first. Open the ServBay app, navigate to “Packages” -> “General Packages”. Find
Apache
in the list and click the green install button on the right to install.
Once the needed web server shows an “Installed” status, you can proceed to switch the default server setting.
How to Set the Default Web Server
The process of setting the default web server is very straightforward. Here’s an example of setting NGINX
as default:
Open the ServBay app.
Navigate to “Settings” -> “Default Web Server”.
In the “Default Web Server” dropdown menu, select the web server you wish to set as default, such as
NGINX
.WARNING
Please note: As mentioned earlier, if you try to select a web server that hasn’t been installed yet (for example, NGINX or Apache), the option will not be available in the dropdown list, or you will not be able to switch. Please make sure to complete the installation first.
Click the “Apply” button at the bottom right of the interface.
ServBay will begin automatically migrating and converting the configuration files for all existing sites. A progress window will appear, showing details of the migration, including which sites have been migrated successfully and which couldn’t be converted automatically (for example, due to custom configurations).
After the site configuration migration is complete, ServBay will automatically start your chosen default web server and stop the others. Your local development environment will now run with the new default web server.
Troubleshooting
If you encounter issues during switching the default web server or configuration migration—for example, websites become inaccessible or configuration errors occur—refer to ServBay’s Web Server Service Troubleshooting Guide for common troubleshooting steps and solutions.