Manage a Custom VPS with Laravel Forge
This week Taylor Otwell announced support of custom SSH ports for servers managed by Laravel Forge. Some time ago I also requested this feature and so I'm very happy that Forge finally supports it. It allows you to manage multiple servers by using port forwarding if you only have one static IP available.
Managing a custom VPS with Laravel Forge is actually very simple. At the time of writing Forge needs a fresh installation of Ubuntu 18.04 x64 and a root user to make its magic happen. To setup the server I did the following steps.
- Install a fresh Ubuntu 18.04 x64 on a server
- Enable the root user by setting its password with
- Setup a "Custom VPS" in Forge and enter the server's data
- Change to root user with
cdto root's home directory
- Execute the install script Forge provides after creating the server and
- Add your SSH key via Forge so you can connect to the server again (Forge disables SSH password authentication by default)
- Connect to your server with
- Disable the root user again by unsetting its password
sudo passwd -dl root
- Remove the user you've created during the Ubuntu installation with
sudo deluser --remove-home <user>, use the forge user instead
- Have fun managing your server with Laravel Forge!
I hope this post was helpful, let me know what you think about it :)