Default and Hidden Sites 0:00In the last video, we subscribed to Forge, configured our server and source control providers of choice, then provisioned a server and deployed the Laravel repository to it. Now with our app or web server provisioned, we're able to create and manage our own sites. Creating a site is ridiculously easy in Forge, but first we need to go back down to the active sites list here and just go over a couple of things. As we mentioned in the last video, Forge creates a default site, that is, that the root domain is just simply called default. This site responds to any requests made to the server's IP address. Of course, you're free to delete this site from your server and requests will then start to return a 404 status code.Of course, you're free to delete this site from your server and requests will then start to return a 404 status code. You may always recreate the default site by creating a new site with a root domain of default. The second site is actually hidden from the active sites list, and this is a special site that tells your server to drop any requests from domains that are not yet configured on your server. This is to prevent malicious domains from pretending to be owned by you. And any requests made to sites that do not exist on your server will return a 444 status code, which simply tells Nginx to immediately drop the connection without sending any response Creating a New Site 1:06And any requests made to sites that do not exist on your server will return a 444 status code, which simply tells Nginx to immediately drop the connection without sending any response to the client. Okay, let's take a look at the new site form. First we're asked for the root domain, which is just the primary domain name of our site. Nginx will also use the root domain as the name of the directory in which our code will get cloned into. In this case, we're going to create a site called zonda.quest, because we're all on the quest for that zonda goodness. Next we can provide aliases of our site.quest for that zonda goodness. Next we can provide aliases of our site. This will typically be used if you're running a multi-tenant application with just a couple of subdomains. Keep in mind that site redirects and security rules will apply to all domains listed in both the root domain and the aliases list. Now although Forge is a Laravel product, it can deploy more than just Laravel applications. When we select the project type, you'll see general PHP and Laravel, Laravel Octane, static HTML, and different versions of Symfony. For now, our site is going to be running Laravel, so we'll leave it like this.HTML, and different versions of Symfony. For now, our site is going to be running Laravel, so we'll leave it like this. The web directory is where our index.php or index.html files live. Now typically this is just going to be left as the default public, but if we're using Forge in conjunction with another product like Envoyer, we might want to update this to slash current slash public. In this case, we're going to leave it as public. Now if our server is running multiple versions of PHP, we can select which version we want to use. Since this server is only running PHP 8.1, that's my only option. Advanced Site Options 2:37to use. Since this server is only running PHP 8.1, that's my only option. And now at the bottom of the form, there are three checkboxes. If you're running a multi-tenant site where customers can subscribe and create their own plugins, you wouldn't want to update your site every time a new customer joins. Instead, you can enable this option and Forge will automatically configure your site to respond to any subdomain. Website isolation is an advanced feature of Forge that creates your site within its own PHP FPM pool. This means that a new system user is created and runs the entire PHP FPM process insteadPHP FPM pool. This means that a new system user is created and runs the entire PHP FPM process instead of the default Forge user. This is particularly useful if you're going to install WordPress and additional third party plugins that might contain malicious code. This will stop it from being able to modify files outside of its own home directory. Finally, because we've created an app server which contains a database, we can also create a new database alongside our site. For this, we're going to call it Zonda. Let's go ahead and add our site. Point DNS to Server 3:36For this, we're going to call it Zonda. Let's go ahead and add our site. Now once Forge has finished installing it, we'll need to go ahead and update our domain's DNS records to point our domain to our server's IP address. You should make sure that you create an A record for the domain name, and be warned that DNS changes can take up to about 48 hours to propagate, so you may need to wait for these changes to become live. Now that our site has been created, Forge will allow us to install a repository. If our server is an app server like this one, then Forge will also provide us with the ability to install WordPress and PHPMyAdmin instead of our own code. Installing the Repository 4:08If our server is an app server like this one, then Forge will also provide us with the ability to install WordPress and PHPMyAdmin instead of our own code. And so long as we have created a new database and database user, we'll be able to go ahead and use those options. Now when installing a Git repository, we can select our provider of choice. In this case, I've only linked GitHub to my Forge account. We can of course connect multiple Git providers through the account settings page, which we can access by clicking this link. Alternatively, we may use a custom Git provider, which is perfect if our code is hosted elsewhere. Now since we're using GitHub, we'll use that.Alternatively, we may use a custom Git provider, which is perfect if our code is hosted elsewhere. Now since we're using GitHub, we'll use that. Once we've entered the repository name, Forge is automatically going to fetch the available list of branches and suggest them in the branch input field. For this repository, we're just going to go with main. And since we're deploying a Laravel application, I'm going to make sure that I'm installing Composer dependencies. Finally, we have the option to generate a deploy key. Now this is an advanced feature which is useful if we're going to give Forge access to perhaps a specific repository that might not be owned by our connected Git account.Now this is an advanced feature which is useful if we're going to give Forge access to perhaps a specific repository that might not be owned by our connected Git account. We can then go ahead and install our repository. Now whilst Forge does this, I want to point out that when installing a repository, Forge is actually doing what's called a shallow clone with a single branch. This means that your site will only have the branch clone that is being installed and only the most recent 50 commits. This means that you can't simply SSH into the server and switch branches or jump through the Git history. You'll need to run some additional commands to do this. Environment File Setup 5:43the Git history. You'll need to run some additional commands to do this. Forge does this to speed up the installation process, as larger repositories can take quite a while to install. Now that the site has been installed, Forge has redirected us to the zonda.quest panel. If we click into the environment panel, you'll notice that Forge has already created and configured the environment file for us. We mentioned in the last episode that Forge does this by copying the .env.example file and automatically updating some of the variables so that our application can be deployed and made live quicker.and automatically updating some of the variables so that our application can be deployed and made live quicker. You'll see as well that we've already generated the key used by the application. Of course we can make changes to this file and save them at any time.