How to set up Laravel Forge on your VPS server
In this tutorial we will have a look at Laravel Forge - a tool that makes deploying PHP applications easy without requiring any prior knowledge on how to manage a Linux server.
Setup requirements
Based on the Forge documentation, you are going to need the following:
- A VPS server with Ubuntu 20 or Ubuntu 22 installed
- At least 1 CPU core @ 1Ghz, 1GB RAM and 10GB disk , all of which are included in our VPS plans
- Installed packages: curl
Finally, you will also need to have an account on the Forge platform with an active subscription.
Step 1: Add your custom VPS to Forge
Open the Forge control panel and click on the “Create Server” button. This will open a modal window, allowing you to select a provider from the already existing ones. From here, select the “Custom VPS” button as shown:
Step 2: Choose Ubuntu as an operating system
Next, select Ubuntu 20 or 22 from the options in the “Server OS” menu. Then, move to the Type section. Here is the amazing part - not only can you easily deploy full app builds (with web server, php, cache, database) with Forge, but also do just a single database or a load balancer for example.
Step 3: Select app server type
For very small projects, we recommend using the “App server” type. Regardless, there are multiple server types, which will benefit applications from all sizes, allowing you to choose a different server type from these options:
Step 4: Populate the other fields
Next, you will need to input the other settings including the IP address of your server, the SSH port, which will be the default 22 port if you just provisioned your VPS, the PHP version and the database version as well as all other blank fields.
Once you have finished entering the data, click on the “Create Server” button and the system will give you a command to run on your VPS using SSH.
The command will look similar to this:
wget -O forge.sh "https://forge.laravel.com/servers/ID/vps?forge_token=YOUR_FORGE_TOKEN"; bash forge.sh
The software will also give you your new server root password as well as a database root password. Copy them and store them in a safe place!
NOTE: Laravel Forge will disable password authentication for your server. You will need to manually create and set up a SSH key. You can follow our tutorial on how to generate your own SSH key.
Step 5: Run the generated command & monitor the installation process
Next, run the command which you received. Once finished, you will be able to monitor the status of the installation of your server through the control panel:
Once the installation completes, a new panel will open, which will have plenty of customization options for your VPS:
What makes Forge so good?
In addition to allowing people without any prior experience to manage their VPS server. Overall, Forge is an extremely powerful tool that not only allows you to easily set up applications, but also enables you to easily maintain it with features like:
- Easy new website additions
- Doing database backups on a remote servers
- Firewall with a friendly UI
- Creating new databases and users with a few clicks
- SSH keys management
- Easy setup for daemons for Laravel Horizon or Laravel queue
- Changing PHP versions directly from the UI
Laravel Forge can be installed on both a VPSBG VPS and VDS server without any issues.