Issue in setting up different port for multiple sites in my Ubuntu 16.04 VPS using LAMP.

Below are the configurations i have used:


# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf

#NameVirtualHost *:80
Listen 80
Listen 1000

<IfModule ssl_module>
    Listen 443

<IfModule mod_gnutls.c>
    Listen 443


    //Default config here

<VirtualHost *:1000>
ServerName localhost
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/My_Site
<Directory /var/www/html/My_Site>
      Options Indexes FollowSymLinks MultiViews
      AllowOverride None
      Order allow,deny
      allow from all
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

Problem is :

a) if i service apache2 reload the configurations given above isnt reflecting in etc\apache2\sites-enabled\000-default.conf

b) My custom port 1000 seems to be listening, but the apache2's default homepage is loading by hitting by IP.

1) Is my document root : DocumentRoot /var/www/html/My_Site correct?

Suggestion appreciated!!

  • <VirtualHost> should of course be <VirtualHost *:80>, no? – AlexP Nov 23 '16 at 12:15
  • I have updated the answer @Alex... but i need my port 1000 to hit my specified document root – Sushivam Nov 23 '16 at 12:16
  • I understand that you want to have two virtual hosts, one listening on port 80 and one on port 1000. See Virtual Hosts Examples -- httpd.apache.org/docs/2.4/vhosts/examples.html --in Apache documentation. – AlexP Nov 23 '16 at 12:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.