Simon Kollross

Simon Kollross

Software developer, blogger, elegant code enthusiast.

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.

  1. Install a fresh Ubuntu 18.04 x64 on a server
  2. Enable the root user by setting its password with sudo passwd
  3. Setup a "Custom VPS" in Forge and enter the server's data
  4. Change to root user with sudo su and cd to root's home directory
  5. Execute the install script Forge provides after creating the server and logout
  6. Add your SSH key via Forge so you can connect to the server again (Forge disables SSH password authentication by default)
  7. Connect to your server with ssh forge@<server-ip>
  8. Disable the root user again by unsetting its password sudo passwd -dl root
  9. Remove the user you've created during the Ubuntu installation with sudo deluser --remove-home <user>, use the forge user instead
  10. Have fun managing your server with Laravel Forge!

I hope this post was helpful, let me know what you think about it :)