When you provision a new server with Laravel Forge, it automatically creates a "default" site. This is a placeholder and serves as a starting point for your server configuration. It's normal to see this "default" site alongside any domains you add manually.
Here's what you should consider:
-
Keep "mydomain.com": This is the domain you added and the one you intend to use for your application. You should configure this domain with the necessary settings, such as pointing your web root to the public directory of your Laravel application, setting up SSL, etc.
-
Default Site: The "default" site can be left as it is, or you can remove it if you're not using it. It's there as a catch-all configuration and doesn't interfere with your other domains. If you decide to keep it, any requests that don't match your other domain configurations will be served by this default site, which can be useful for catching misconfigured DNS requests or showing a generic landing page.
To remove the "default" site, you can follow these steps:
- Log in to your Laravel Forge dashboard.
- Select the server you're working with.
- Go to the "Sites" tab.
- Find the "default" site in the list.
- Click on the "Delete" button to remove it.
If you choose to remove the "default" site, make sure that you have configured "mydomain.com" correctly and that all DNS settings are pointing to your server's IP address.
Here's a code example of how you might configure the Nginx server block for "mydomain.com" (although Forge handles this for you):
server {
listen 80;
server_name mydomain.com www.mydomain.com;
root /path/to/your/laravel/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
Remember to replace /path/to/your/laravel/public with the actual path to your Laravel application's public directory and php7.4-fpm.sock with the correct PHP version socket you are using.
In summary, use "mydomain.com" for your application, and decide whether to keep or remove the "default" site based on your needs. It's not a bug; it's just how Forge sets up new servers.