Run apps in any language
You can use ServerPilot to host apps written in languages other than PHP, for example:
Create an app
In the ServerPilot dashboard, create an app and choose any PHP version. The PHP version doesn’t matter as you aren’t going to use PHP.
Run your app’s built-in server
Follow your app’s installation instructions for running your app using its built-in web server.
For Node apps, nvm is the easiest way to install a specific version of Node.
Proxy requests to your app
SSH into your server as the app’s system user and create the file:
apps/APPNAME/public/.htaccess
with the following contents,
replacing PORT
with the port your app is running on:
RewriteRule index.html http://localhost:PORT/ [P]RewriteRule (.*) http://localhost:PORT/$1 [P]
If you haven’t yet updated DNS for your domain to resolve to your server’s IP address, you can preview your app using your server’s address by adding the server’s address as one of your app’s domains.
Start your app on boot
There are multiple ways to automatically start your app’s built-in web server
anytime you reboot your server.
The easiest is to use cron’s @reboot
functionality.
SSH into your server as the app’s system user and edit the system user’s crontab.
crontab -e
Add the following entry, setting the appropriate command to start your app’s built-in web server. For example:
@reboot cd /srv/users/SYSUSER/apps/APPNAME && npm run prod