Configure your Web Server
There are a couple of things you need to take care of in order to configure your project’s Web Server appropriately and get its Public URL working:
- Create a Procfile with your server’s command
- Listen to the appropriate port
Command
Your project’s server should be executed as a foreground command. What this command will be depends heavily on the programming language and the framework you are using (e.g. Django, Sails, Symfony etc.).
This command should be declared in the Procfile of your project.
Port
Your project’s server should always bind at the port defined by the PORT
environment variable.
Example Procfile
This is an example Procfile running the Django development server and binding to the port defined by the PORT
environment variable.
web: python app/manage.py runserver $PORT