How to Run Apps in Any Language
Unless you're absolutely sure about what you're doing, you should stop now!
Though not supported by ServerPilot, it is possible to run apps written in languages other than PHP on your server. These include
- Node.js apps such as Ghost,
- Python apps such as Django,
- Ruby apps built with Rails, and
- Go apps built with Revel.
Step One: Connect a New Server to ServerPilot
You should start with a new server rather than one you're using for PHP apps. This way, if you break your server while installing your non-PHP app, it won't affect your PHP apps.
Step Two: Create an App in ServerPilot
Log in to ServerPilot and create a new app. You can select any PHP version for your app. It won't matter which PHP version you've selected as your app won't use PHP.
If your app needs a MySQL database, create a database for your app through ServerPilot.
Step Three: Install Your Non-PHP App
Follow the instructions for your app to install only the app without any additional web server.
If the instructions you're following are telling you to install or in any way configure Nginx or Apache, do not follow them! Instead, look for instructions that show you only how to install the app itself.
It is safe to install packages that aren't web servers, such as nodejs, npm, ruby, python, pip, java, or perl.
Step Four: Run Your App On Its Own Port
Start your app so that it runs on any high-numbered port. Some apps use a specific port by default. For example, Ghost uses port 2368.
Step Five: Proxy Requests to Your App's Port
SSH or SFTP in to your server as the user the app belongs to (e.g., serverpilot) and create the file apps/APPNAME/public/.htaccess with the following contents (replace 2368 with the port your app is running on):
RewriteRule index.html http://localhost:2368/ [P] RewriteRule (.*) http://localhost:2368/$1 [P]
You can now add a domain to your app through ServerPilot, point DNS for that domain to your server's IP address, and request your app using just the URL:
Things to Remember
Unlike PHP apps, most other apps do not start by default when your server is rebooted. You should follow the instructions provided by your non-PHP app to ensure that it starts by default when you reboot your server.