Ubuntu: Apache (Ubuntu) Virtual host stopped working after upgrade->restart



Question:

I have a simple webserver with a single virtual host.

Domain name have been changed to local.com

After running

apt-get update && apt-get upgrade && apt-get dist-upgrade  

the virtual host is now returning the default website 000-default.conf

The log entries goes to /var/log/apache2/access.log and error.log but no errors.

There's no error when restarting apache2 or with these commands:

root@netcon:/etc/apache2/sites-available# apache2ctl -t  Syntax OK  root@netcon:/etc/apache2/sites-available# apache2ctl -S  VirtualHost configuration:  *:80                   is a NameVirtualHost           default server netcon.local.com (/etc/apache2/sites-enabled/000-default.conf:1)           port 80 namevhost netcon.local.com (/etc/apache2/sites-enabled/000-default.conf:1)           port 80 namevhost netcon.local.com (/etc/apache2/sites-enabled/netcon.local.com.conf:1)  ServerRoot: "/etc/apache2"  Main DocumentRoot: "/var/www/html"  Main ErrorLog: "/var/log/apache2/error.log"  Mutex default: dir="/var/lock/apache2" mechanism=fcntl  Mutex mpm-accept: using_defaults  Mutex watchdog-callback: using_defaults  Mutex rewrite-map: using_defaults  PidFile: "/var/run/apache2/apache2.pid"  Define: DUMP_VHOSTS  Define: DUMP_RUN_CFG  User: name="www-data" id=33  Group: name="www-data" id=33  root@netcon:/etc/apache2/sites-available#  

There's only one virtual host:

root@netcon:/etc/apache2/sites-available# ll  total 40  drwxr-xr-x 2 root  root  4096 Apr 26 13:08 ./  drwxr-xr-x 8 root  root  4096 Apr 26 12:57 ../  -rw-r--r-- 1 root  root  1332 Mar 19  2016 000-default.conf  -rw-r--r-- 1 root  root  6338 Apr  5  2016 default-ssl.conf  -rw-r--r-- 1 root  root  2015 Nov 22 12:14 _netcon.gk.conf  -rw-r--r-- 1 root  root   815 Apr 26 13:08 netcon.local.com.conf  -rw-r--r-- 1 root  root   826 Apr 26 13:07 netcon.local.com.conf~  -rw-r--r-- 1 root  root  1391 Mar  3 12:59 netcon.local.com.conf_  -rw-r--r-- 1 root  root   814 Apr 26 12:58 netcon.local.com.conf_backup    root@netcon:/etc/apache2/sites-available# cat netcon.local.com.conf    <VirtualHost *:80>          # All comments have been removed.          # See 000-default.conf for default comments.            # Server configuration          ServerName netcon.local.com  #        ServerAlias *netcon.local.com            ServerAdmin it@local.com          DocumentRoot /data/srv/web/netcon.local.com            # Directory permissions          <Directory /data/srv/web/netcon.local.com/>            Options Indexes FollowSymLinks Includes            AllowOverride All            Require all granted          </Directory>            <Location /data/srv/web/netcon.local.com/>            Require all granted          </Location>            # Logging          ErrorLog ${APACHE_LOG_DIR}/netcon.local.com_error.log          CustomLog ${APACHE_LOG_DIR}/netcon.local.com_access.log combined      </VirtualHost>  

I dont know how to troubleshoot from here, any help appreciated.


Solution:1

Yes there's the correct files in /etc/apache2/sites-enabled made with a2ensite.

They also work as the command apache2ctl -S shows.

And that was also the command that helped me find the error.

root@netcon:/etc/apache2/sites-available# apache2ctl -S  VirtualHost configuration:  *:80                   is a NameVirtualHost           default server netcon.local.com (/etc/apache2/sites-enabled/000-default.conf:1)           port 80 namevhost netcon.local.com (/etc/apache2/sites-enabled/000-default.conf:1)           port 80 namevhost netcon.local.com (/etc/apache2/sites-enabled/netcon.local.com.conf:1)  

There's two times netcon.local.com and the first one is pointing to 000-default.conf that's why (I guess) the default page is shown. When I disable the default site with a2dissite my website works.

Why this turns up after an upgrade I don't know; maybe someone can explain it? Hostname = website name?


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »