Useful Snippets


This blog is used to collect useful snippets related to Linux, PHP, MySQL and more. Feel free to post comments with improvements or questions!

Are your smart devices spying on you? Make better purchasing choices and find products that respect your privacy at

RSS Latest posts from my personal blog

Most viewed posts

Subscribe to RSS feed

Configuring Apache to use an alternative port on Ubuntu

Stanislav KhromovStanislav Khromov

To change from the default port 80 to another port, say 14000 – you need to change the configuration in two places.

First, change the default virtual host (000-default):

vim /etc/apache2/sites-enabled/000-default

Change the first line as below and save the file.

<VirtualHost *:14000>

Changing the default Virtual host isn’t enough though. When you start apache you might see this error:

service apache2 restart
* Restarting web server apache2
... [warn] NameVirtualHost *:80 has no VirtualHosts

That is because you also need to change the ports configuration file:

vim /etc/apache2/ports.conf

Change the config so it looks like this:

NameVirtualHost *:14000
Listen 14000

Restart apache and you’re all set!

service apache2 restart

Web Developer at Aftonbladet (Schibsted Media Group)
Any opinions on this blog are my own and do not reflect the views of my employer.
Twitter Profile
Visit my other blog

Comments 0
There are currently no comments.