Virtual Host error after upgrade to Virtualmin pro

Afte ran u9pgrade to virtualmin pro all the sites show the main apache page.

Status: 
Active

Comments

Howdy -- was your server previously running Virtualmin GPL? Or were those existing sites created outside of Virtualmin?

it was running GPL yes and after the upgrade i noticed that all are missing from Webmin > Servers > apache webserver > Existing virtual hosts. If i try to create new website it works.

All configurations files seems to be ok in /etc/apache2/sites-available but all sites ( avikel.com for example does not work.

I figured out that the simbolyc links are missing and sites were disabled for some reason along with a lot of modules (PHP modules)

root@vps1:/var/log/apache2# systemctl status apache2.service ● apache2.service - LSB: Apache2 web server Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled) Drop-In: /lib/systemd/system/apache2.service.d └─apache2-systemd.conf Active: failed (Result: exit-code) since Sun 2017-01-22 21:55:26 EET; 5s ago Docs: man:systemd-sysv-generator(8) Process: 3566 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

Jan 22 21:55:26 vps1.osp3d.com apache2[3566]: * Jan 22 21:55:26 vps1.osp3d.com apache2[3566]: * The apache2 configtest failed. Jan 22 21:55:26 vps1.osp3d.com apache2[3566]: Output of config test was: Jan 22 21:55:26 vps1.osp3d.com apache2[3566]: Segmentation fault (core dumped) Jan 22 21:55:26 vps1.osp3d.com apache2[3566]: Action 'configtest' failed. Jan 22 21:55:26 vps1.osp3d.com apache2[3566]: The Apache error log may have more information. Jan 22 21:55:26 vps1.osp3d.com systemd[1]: apache2.service: Control process exited, code=exited status=1 Jan 22 21:55:26 vps1.osp3d.com systemd[1]: Failed to start LSB: Apache2 web server. Jan 22 21:55:26 vps1.osp3d.com systemd[1]: apache2.service: Unit entered failed state. Jan 22 21:55:26 vps1.osp3d.com systemd[1]: apache2.service: Failed with result 'exit-code'.

Hmm, how did you go about the upgrade?

Did you use System Settings -> Upgrade to Virtualmin Pro?

Or did you perhaps re-run the Virtualmin installer?

Running the installer is only meant for new installs, and could cause some config issues.

It sounds like you're seeing an Apache configuration error at the moment, which could be due to the missing modules that you mentioned, which just means we need to figure out which ones are missing.

What is the output of this command, this will show what issues Apache is seeing:

apache2ctl configtest

I did start the command from your website next tot he license and after that nothing happened. No new scripts or what so ever popped up so i then did System Settings > Upgrade and entered my license keys.

I narrowed the problem down to the configurations of the sites. If i disable all sites apache works.

root@vps1:/etc/apache2/sites-enabled# apache2ctl configtest Segmentation fault (core dumped) Action 'configtest' failed. The Apache error log may have more information.

This is ridiculous - i buy your product and thing get worse! I need you to fix this asap!

Yeah that command there is for folks with new installs, not for upgrades; sorry for the confusion!

What is the output of these three commands, this will help us understand what's going on there:

ls -l /etc/apache2/sites-enabled/
ls -l /etc/apache2/sites-available/
ls -l /etc/apache2/mods-enabled/

Also, are you seeing any additional errors in /var/log/apache2/error_log?

root@vps1:/etc/apache2/sites-available# ls -l /etc/apache2/sites-enabled/
total 0
lrwxrwxrwx 1 root root 35 Jan 22 22:46 000-default.conf -> ../sites-available/000-default.conf
lrwxrwxrwx 1 root root 40 Jan 22 22:56 art-katerina.com.conf -> ../sites-available/art-katerina.com.conf
lrwxrwxrwx 1 root root 34 Jan 22 22:47 avikel.com.conf -> ../sites-available/avikel.com.conf
lrwxrwxrwx 1 root root 32 Jan 22 22:56 bekra.bg.conf -> ../sites-available/bekra.bg.conf
lrwxrwxrwx 1 root root 40 Jan 22 22:56 danhillphoto.com.conf -> ../sites-available/danhillphoto.com.conf
lrwxrwxrwx 1 root root 35 Jan 22 22:56 default-ssl.conf -> ../sites-available/default-ssl.conf
lrwxrwxrwx 1 root root 38 Jan 22 22:56 mitrevamat.com.conf -> ../sites-available/mitrevamat.com.conf
lrwxrwxrwx 1 root root 40 Jan 22 22:56 outlet4tools.com.conf -> ../sites-available/outlet4tools.com.conf
lrwxrwxrwx 1 root root 38 Jan 22 22:56 toolsmarket.bg.conf -> ../sites-available/toolsmarket.bg.conf
lrwxrwxrwx 1 root root 36 Jan 22 22:56 zitamoda.com.conf -> ../sites-available/zitamoda.com.conf
root@vps1:/etc/apache2/sites-available# ls -l /etc/apache2/sites-available/
total 60
-rw-r--r-- 1 root root 1332 Mar 19  2016 000-default.conf
-rw-r--r-- 1 root root 4683 Jan 22 18:26 art-katerina.com.conf
-rw-r--r-- 1 root root 3236 Jan 13 03:00 avikel.com.conf
-rw-r--r-- 1 root root 4660 Jan 13 03:00 bekra.bg.conf
-rw-r--r-- 1 root root 1869 Jan 13 03:00 danhillphoto.com.conf
-rw-r--r-- 1 root root 6338 Apr  6  2016 default-ssl.conf
-rw-r--r-- 1 root root 4500 Jan 13 03:00 mitrevamat.com.conf
-rw-r--r-- 1 root root 4600 Jan 22 19:49 outlet4tools.com.conf
-rw-r--r-- 1 root root 1874 Jan 13 03:00 toolsmarket.bg.conf
-rw-r--r-- 1 root root 1825 Jan 13 03:00 zitamoda.com.conf
root@vps1:/etc/apache2/sites-available# ls -l /etc/apache2/mods-enabled/
total 0
lrwxrwxrwx 1 root root 36 Jan 22 22:46 access_compat.load -> ../mods-available/access_compat.load
lrwxrwxrwx 1 root root 30 Jan 22 22:52 actions.conf -> ../mods-available/actions.conf
lrwxrwxrwx 1 root root 30 Jan 22 22:52 actions.load -> ../mods-available/actions.load
lrwxrwxrwx 1 root root 28 Jan 22 22:46 alias.conf -> ../mods-available/alias.conf
lrwxrwxrwx 1 root root 28 Jan 22 22:46 alias.load -> ../mods-available/alias.load
lrwxrwxrwx 1 root root 33 Jan 22 22:46 auth_basic.load -> ../mods-available/auth_basic.load
lrwxrwxrwx 1 root root 33 Jan 22 22:46 authn_core.load -> ../mods-available/authn_core.load
lrwxrwxrwx 1 root root 33 Jan 22 22:46 authn_file.load -> ../mods-available/authn_file.load
lrwxrwxrwx 1 root root 33 Jan 22 22:46 authz_core.load -> ../mods-available/authz_core.load
lrwxrwxrwx 1 root root 33 Jan 22 22:46 authz_host.load -> ../mods-available/authz_host.load
lrwxrwxrwx 1 root root 33 Jan 22 22:46 authz_user.load -> ../mods-available/authz_user.load
lrwxrwxrwx 1 root root 32 Jan 22 22:46 autoindex.conf -> ../mods-available/autoindex.conf
lrwxrwxrwx 1 root root 32 Jan 22 22:46 autoindex.load -> ../mods-available/autoindex.load
lrwxrwxrwx 1 root root 28 Jan 22 22:50 cache.load -> ../mods-available/cache.load
lrwxrwxrwx 1 root root 33 Jan 22 22:50 cache_disk.conf -> ../mods-available/cache_disk.conf
lrwxrwxrwx 1 root root 33 Jan 22 22:50 cache_disk.load -> ../mods-available/cache_disk.load
lrwxrwxrwx 1 root root 27 Jan 22 22:50 cgid.conf -> ../mods-available/cgid.conf
lrwxrwxrwx 1 root root 27 Jan 22 22:50 cgid.load -> ../mods-available/cgid.load
lrwxrwxrwx 1 root root 26 Jan 22 23:10 dav.load -> ../mods-available/dav.load
lrwxrwxrwx 1 root root 30 Jan 22 22:46 deflate.conf -> ../mods-available/deflate.conf
lrwxrwxrwx 1 root root 30 Jan 22 22:46 deflate.load -> ../mods-available/deflate.load
lrwxrwxrwx 1 root root 26 Jan 22 22:46 dir.conf -> ../mods-available/dir.conf
lrwxrwxrwx 1 root root 26 Jan 22 22:46 dir.load -> ../mods-available/dir.load
lrwxrwxrwx 1 root root 26 Jan 22 22:46 env.load -> ../mods-available/env.load
lrwxrwxrwx 1 root root 28 Jan 22 22:50 fcgid.conf -> ../mods-available/fcgid.conf
lrwxrwxrwx 1 root root 28 Jan 22 22:50 fcgid.load -> ../mods-available/fcgid.load
lrwxrwxrwx 1 root root 29 Jan 22 22:46 filter.load -> ../mods-available/filter.load
lrwxrwxrwx 1 root root 30 Jan 22 22:50 include.load -> ../mods-available/include.load
lrwxrwxrwx 1 root root 27 Jan 22 22:46 mime.conf -> ../mods-available/mime.conf
lrwxrwxrwx 1 root root 27 Jan 22 22:46 mime.load -> ../mods-available/mime.load
lrwxrwxrwx 1 root root 34 Jan 22 22:50 mpm_prefork.conf -> ../mods-available/mpm_prefork.conf
lrwxrwxrwx 1 root root 34 Jan 22 22:50 mpm_prefork.load -> ../mods-available/mpm_prefork.load
lrwxrwxrwx 1 root root 34 Jan 22 22:46 negotiation.conf -> ../mods-available/negotiation.conf
lrwxrwxrwx 1 root root 34 Jan 22 22:46 negotiation.load -> ../mods-available/negotiation.load
lrwxrwxrwx 1 root root 29 Jan 22 22:50 php7.1.conf -> ../mods-available/php7.1.conf
lrwxrwxrwx 1 root root 29 Jan 22 22:50 php7.1.load -> ../mods-available/php7.1.load
lrwxrwxrwx 1 root root 30 Jan 22 23:04 rewrite.load -> ../mods-available/rewrite.load
lrwxrwxrwx 1 root root 31 Jan 22 22:46 setenvif.conf -> ../mods-available/setenvif.conf
lrwxrwxrwx 1 root root 31 Jan 22 22:46 setenvif.load -> ../mods-available/setenvif.load
lrwxrwxrwx 1 root root 29 Jan 22 22:46 status.conf -> ../mods-available/status.conf
lrwxrwxrwx 1 root root 29 Jan 22 22:46 status.load -> ../mods-available/status.load
lrwxrwxrwx 1 root root 29 Jan 22 22:48 suexec.load -> ../mods-available/suexec.load

NO ERRORS IN

root@vps1:/etc/apache2/sites-available# tail -f /var/log/apache2/error.log
[Sun Jan 22 22:46:44.799992 2017] [mpm_event:notice] [pid 17202:tid 140366206797696] AH00489: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Sun Jan 22 22:46:44.800115 2017] [core:notice] [pid 17202:tid 140366206797696] AH00094: Command line: '/usr/sbin/apache2'
[Sun Jan 22 22:46:55.622671 2017] [mpm_event:notice] [pid 17202:tid 140366206797696] AH00493: SIGUSR1 received.  Doing graceful restart
[Sun Jan 22 22:46:55.630253 2017] [mpm_event:notice] [pid 17202:tid 140366206797696] AH00489: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Sun Jan 22 22:46:55.630276 2017] [core:notice] [pid 17202:tid 140366206797696] AH00094: Command line: '/usr/sbin/apache2'
[Sun Jan 22 22:48:22.577584 2017] [mpm_event:notice] [pid 17202:tid 140366206797696] AH00491: caught SIGTERM, shutting down

Okay, first, you may want to try getting rid of these two configs, as they aren't necessary:

a2dismod 000-default
a2dismod default-ssl

After running those two commands, are you able to start Apache?

If not, you may need to remove all the sites in /etc/apache2/sites-enabled -- and then re-add them one at a time, testing Apache after each attempt.

That will show us if there's a problem with all of them, or whether the issue is specific to one particular domain.

root@vps1:/etc/apache2/sites-enabled# a2dismod 000-default ERROR: Module 000-default does not exist! root@vps1:/etc/apache2/sites-enabled# a2dismod default-ssl ERROR: Module default-ssl does not exist! root@vps1:/etc/apache2/sites-enabled#

Sorry that was the wrong command... it's "a2dissite" and not "a2dismod".

The two commands should be:

a2dissite 000-default
a2dissite default-ssl

Also, doing some Googling on this issue, a segmentation fault during the Apache config test is usually due to some sort of Apache module incompatibility.

You may want to try disabling mod_php, which is a common cause of that when it's come from a third party repository.

You can do that with this command:

a2dismod php7.1

I remove php7.0 * and disabled php7.1 and apache started. We need t have php 7.1 working as well.

When disabling mod_php, that shouldn't prevent PHP from working -- that just removes the Apache PHP module.

Virtualmin configures all your domains to use FCGID and CGI by default, mod_php is rarely used (and is something we recommend against for security reasons).

Unless your domains were changed to use mod_php, they should work well with FCGID and CGI.

Are you seeing any problems now though?

If you're seeing any problems, what is the output of this command:

find /etc/apache2 | xargs grep -i sethandler

When i try to open a website avikel.com i see a file downloaded "Download"

root@vps1:/var/log/virtualmin# find /etc/apache2 | xargs grep -i sethandler
grep: /etc/apache2: Is a directory
grep: /etc/apache2/sites-available: Is a directory
grep: /etc/apache2/conf-available: Is a directory
/etc/apache2/conf-available/localized-error-pages.conf:#                  SetHandler directive in a <Location /> context somewhere. Adding
/etc/apache2/conf-available/localized-error-pages.conf:#                         SetHandler none
grep: /etc/apache2/sites-enabled: Is a directory
grep: /etc/apache2/mods-available: Is a directory
/etc/apache2/mods-available/ldap.conf:  SetHandler ldap-status
/etc/apache2/mods-available/proxy_balancer.conf:        #          SetHandler balancer-manager
/etc/apache2/mods-available/info.conf:          SetHandler server-info
/etc/apache2/mods-available/status.conf:                SetHandler server-status
/etc/apache2/mods-available/php7.1.conf:    SetHandler application/x-httpd-php
/etc/apache2/mods-available/php7.1.conf:    SetHandler application/x-httpd-php-source
grep: /etc/apache2/conf-enabled: Is a directory
/etc/apache2/conf-enabled/localized-error-pages.conf:#            SetHandler directive in a <Location /> context somewhere. Adding
/etc/apache2/conf-enabled/localized-error-pages.conf:#                   SetHandler none
grep: /etc/apache2/mods-enabled: Is a directory
/etc/apache2/mods-enabled/proxy_balancer.conf:  #          SetHandler balancer-manager
/etc/apache2/mods-enabled/status.conf:          SetHandler server-status
/etc/apache2/mods-enabled/php7.1.conf:    SetHandler application/x-httpd-php
/etc/apache2/mods-enabled/php7.1.conf:    SetHandler application/x-httpd-php-source
grep: /etc/apache2/suexec: Is a directory

Yeah it looks like the "php7.1" module is enabled, and contains some config entries in it that would force mod_php on all domains.

That can cause the symptoms you're seeing now.

If you wish to have mod_php enabled in Apache, you may want to edit "/etc/apache2/mods-enabled/php7.1.conf", and comment out the two "SetHandler" lines in it.

After doing that, restart Apache, and then try accessing your site again.

All those are set but now the server is rather slow. Is it possible for you o log in via the remote access that i provided and check what is the issue? I am mising the option to choose a server to run with php_mod which i want to use with php_apcu so that i can have faster websites.

What is your recommendation

If mod_php isn't showing up as an option, that might be a good place to start.

Just to verify -- you're saying that in Server Configuration -> Website Options, you don't see mod_php there listed as a PHP Execution Mode?

We unfortunately don't have any specific recommendations for a PHP cache, though I can offer that you may want to look into both a PHP cache, as well as something like memcache, which caches database lookups.

It is not showing that is correct. What is see is: PHP script execution mode CGI wrapper (run as virtual server owner) FCGId (run as virtual server owner)

I am wondering weather there is a cache that can be used for FCGId?

Yes most of the PHP caches should work well with FCGID.

Also, FCGID performance is normally pretty similar to mod_php.

I'm not quite sure why mod_php isn't showing up there, I'll ask Jamie about that (Jamie knows everything!)

Just to verify that something else on your server isn't slowing things down, what is the output of these commands:

uptime
free -m
mailq | tail -1

I'm also sending Jamie a message now to get some more information about mod_php though.

root@vps1:/home/zitam/public_html# uptime 20:15:33 up 20:45, 1 user, load average: 0.16, 0.10, 0.12 root@vps1:/home/zitam/public_html# free -m total used free shared buff/cache available Mem: 3007 1628 283 100 1096 1055 Swap: 1019 224 795 root@vps1:/home/zitam/public_html# mailq | tail -1 Mail queue is empty

One more thing now all permissions to all virtual hosts have to be 775 instead of 755 in order to get them working - why is that?

Your information all looks good there, so there doesn't appear to be any sort of RAM or resource issue.

Let's see what Jamie has to say about getting mod_php working again, as that may also resolve the permission issues you mentioned there. He should be getting back with us shortly.

Okay, I talked to Jamie. One of the issues is that since PHP 7.1 is new, and isn't a standard part of any distro yet, Virtualmin doesn't know how to detect it.

We should be able to fix that though.

What is the output of these two commands:

apache2ctl -M
/etc/webmin/apache/site

That will give us some info about what modules Apache is seeing, so that we can modify Virtualmin to be able to detect mod_php version 7.1.