Idris Hanafi Idris Hanafi - 1 month ago 14
Apache Configuration Question

How to make a Django+Ember application run on a domain name and a certain port number

I want to run a Django+Ember website on my website on a certain port number (eg. 54321), for example: domain-name.com:54321.

I got the Django+ember application working on my domain name (without the port number specified) like domain-name.com. I can not get it working with the command:

python3 manage.py runserver domain-name.com:54321


Do I need to add anything to my
/etc/httpd/conf/httpd.conf
file? I know my current configuration for the httpd.conf file is correct because it works without a port number. But what am I missing to make it work on a certain port number?

Answer

You have to add the port to your httpd.conf configuration. Example:

Listen 54321
<VirtualHost domain-name.com:54321>
    DocumentRoot "/var/www/my-django-app/"
    ServerName domain-name.com
    # Other things...
</VirtualHost>

Don't forget to restart your apache service... For more information read the documentation: https://httpd.apache.org/docs/2.4/vhosts/examples.html