Bineesh Kumar
Bineesh Kumar

Reputation: 166

How to avoid port number in django app url in comination with apache2

My django website is hosted on ubuntu apache2 vps which reserves port 80. I want to hide or avoid portnumber in django url. By googling i learnt using port 80 will help for that. But apache2 has reserved port 80. Is there any workaround to fix it ? Any hint will be greatly apprecitated.

Upvotes: 0

Views: 315

Answers (1)

crimsonpython24
crimsonpython24

Reputation: 2383

Since you're on Ubuntu, you may try opening this file:

sudo vi /etc/apache2/ports.conf

And change the listened port from Listen 80 to something like Listen 8080.

However, when you change Apache's port, you need to also change port number in virtual host config. The file will either be at

sudo vi /etc/apache2/sites-enabled/mysite.conf
sudo vi /etc/apache2/sites-enabled/000-default.conf

And change the port from <VirtualHost: *:80> to <VirtualHost: *:8080>

Lastly, restart the Apache server.

sudo systemctl restart apache2 #SystemD
sudo service apache2 restart #SysVInit

Hope this helps!

Upvotes: 1

Related Questions