Vhost, php and 503

NethServer Version: 7.8.2003
Module: vhost, php

Hi,

Today I dared to transfer my old website from Zentyal to Nethserver. It was based on Drupal. I tried some time before, but due to lack of time, I gave up. Today my trails were harder … but also not successful.

  • I set up a vhost called www.mydomain.tld.
  • I downloaded and moved Drupal to /var/lib/nethserver/vhost/www
  • I set up user/group to apache:apache and rights were 755, recursively, of course
  • I called my website but all I got was

503 - Service Unavailable

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

OK, back to the roots, I removed the content from www and called the website - fine. I got the “standard default data”

  • I added a tiny little “Hello-World” script to index.php in /var/lib/nethserver/vhost/www/
    … but all I got was

503 - Service Unavailable

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

  • I moved index.php to index.html and changed the “Hello World-PHP code” to some simple text.
    This time it worked. Other Sites applying php code (such as phpmyadmin, phpmyldap, SoGo, Nextcloud…) work with charm.

Of course I tried 503 Service Unavailable Error but no success
By change: Can somebody help me out to get php code working on www?

TIA
Thorsten

Got it stupid me - it was an old vhost which I simply made empty. I removed and re-created the vhost … now it seems to work (besides the fact that the vhosts folder name is now something cryptic instead a speaking name suche as www)

1 Like

Hi Thorsten

You should never name a vhost as www since it is already in use if you defined the FQDN of your domain under System → DNS → Add DNS record and you enabled Wildcard DNS record.

If you go to www.FQDN you should get the content of /var/www/html/, the defautl site for NethServer.

I you go to www.FQDN/vhost-directory-name/ then you should get the content of /var/lib/nethserver/vhost/vhost-directory-name/, the content of your vhost i.e. your Drupal.

The order of index.xxx is defined by Apache directive DirectoryIndex which can be orverridden by .htacess in the root directory of your site. Usually the order is index.html, index.htm, index.phphttps://httpd.apache.org/docs/2.4/en/mod/mod_dir.html and http://www.htaccess-guide.com/directoryindex-uses/

If you use the module Reverse Proxy, then you can define vhost-directory-name.FQDN to point to /var/lib/nethserver/vhost-directory-name/.

You should never use FTP and change the OWNER:GROUP of /var/www/html/ and /var/lib/nethserver/vhost/vhost-directory-name/ to apache:apache.

If you are starting a new web site, you should use WordPress as it is much, but very much, easier to update to a new main version than Drupal.

Michel-André

Hi Michel-Andre,

To which owner:group should it be set? I do not know why, but I already got apache:apache for matomo (former Piwik). If I changed it, I am quite sure I followed the installation instruction.

The regular default seems to be ftp:apache. This is reagardless if FTP access is not enabled or not. So I will return to this.

No, definitely not. It was as you describe for Nethserver, but now, if I create a vhost (e.g. foo), I get a complete cryptic directory name under /var/lib/nethserver/vhost/. The vhost-directory-name is a 15 digit hex code equal to the ftp user name if enabled. I understand this in order to separate “NS-Domain users FTP access” from “vhost FTP users”, but I am not sure what the background is.

Best regards
Thorsten

Hi Thorsten,

You are right about FTP, enabled or not, a new vhost directory OWNER:GROUP is ftp:apache.
If you leave it that way, the update for WordPress won’t work. That is why I always change to apache:apache. WordPress doesn’t use the NethServer FTP but its own way to get the updating files.
For Drupal, I do not know as I don’t use it, but I think it will be the same.

That is not normal. For the directory, you should get the same name as the one used when creating the vhost.

# ls -als /var/lib/nethserver/vhost/
total 0
0 drwxr-xr-x   3 root root    18 27 août  10:14 .
0 drwxr-xr-x. 12 root root   150 24 juin  13:51 ..
0 drwxr-sr-x   2 ftp  apache   6 27 août  10:14 toto
#

# chown -R apache:apache /var/lib/nethserver/vhost/toto
#

# ls -als  /var/lib/nethserver/vhost/
total 0
0 drwxr-xr-x   3 root   root    18 27 août  10:14 .
0 drwxr-xr-x. 12 root   root   150 24 juin  13:51 ..
0 drwxr-sr-x   2 apache apache   6 27 août  10:14 toto
#

I might be wrong but I think that NethServer is creating this name because you use www for another vhost.
By the way, the hexcode for FTP is 14: image

For a test after changing the name of the vhost using www, try to create a new vhost that its name is never been used before:

  • Create a /temp directory
  • cp -a /var/lib/nethserver/vhost/www /temp
    (-a, --archive / same as -dR --preserve=all)
  • delete the www vhost.
  • create a new vhost that its name has never been used before and verify the name of the new vhost directory.
  • if all went right with the previous procedure, create a new vhost for your Drupal (ex: drupal, and verify that NethServer used drupal as the directory name)
  • cp -a /temp/www/* /var/lib/nethserver/vhost/drupal/
  • change -R (Recursive) owner:group to apache:apache (to be able to update Drupal)

You should be able to access your Drupal site with: https://FQDN/drupal.
If Drupal site doesn’t display, adjust the config file of Drupal to use the new FQDN/site (It is like moving Drupal to a new site).

Another way will be to copy your Drupal site to: /var/www/html/ and it will be the new default site for NethServer.

Michel-André

I think Nethserver changed the handling - the website is reachable at www.mydomain.tld

Hi Thorsten,

The only thing I can say is that’s a pleonasm to use www as a sub-domain.

Michel-André