When I create a new website using a subdomain - sub.domain.com - the browser always lands on the default apache "it works" page. It shows the content of /var/www/html instead of /var/www/sub.domain.com As this website is standalone I created it using Sites->Add New Website. DNS records are working and pointing to this server. All records in sites-available and sites-enabled look fine to me. All regular sites are working fine. HOWEVER - the main domain - www.domain.com is hosted at another IP - can this be part of the problem? Using ispconfig 3.5.1 on Ubuntu 16.04 thanks in advance
The default page is shown when apache does not find a vhost file with the right IP address + domain / subdomain combination. So there are the following possibilites: the vhost file has not been written (check that in /etc/apache2/sites-enabled/, there must be a file for this subdomain without .err ending, another possibility is that there is a typo in the domain name or you selected the wrong IP.
Thanks for your quick reply. If this was just one page I could see why a typo could be the culprit, but this happens with every new subdomain. Let me illustrate with some screendumps: I will use my latest subdomain as an example: http://nyt.ammenet.dk
inside the vhost file: Code: <Directory /var/www/nyt.ammenet.dk> AllowOverride None Require all denied </Directory> <VirtualHost *:80> DocumentRoot /var/www/nyt.ammenet.dk/web ServerName nyt.ammenet.dk ServerAdmin [email protected] ErrorLog /var/log/ispconfig/httpd/nyt.ammenet.dk/error.log Alias /error/ "/var/www/nyt.ammenet.dk/web/error/" ErrorDocument 400 /error/400.html ErrorDocument 401 /error/401.html ErrorDocument 403 /error/403.html ErrorDocument 404 /error/404.html ErrorDocument 405 /error/405.html ErrorDocument 500 /error/500.html ErrorDocument 502 /error/502.html ErrorDocument 503 /error/503.html <IfModule mod_ssl.c> </IfModule> <Directory /var/www/nyt.ammenet.dk/web> # Clear PHP settings of this website <FilesMatch ".+\.ph(p[345]?|t|tml)$"> SetHandler None </FilesMatch> Options +FollowSymLinks AllowOverride All Require all granted </Directory> <Directory /var/www/clients/client0/web12/web> # Clear PHP settings of this website <FilesMatch ".+\.ph(p[345]?|t|tml)$"> SetHandler None </FilesMatch> Options +FollowSymLinks AllowOverride All Require all granted </Directory> # suexec enabled <IfModule mod_suexec.c> SuexecUserGroup web12 client0 </IfModule> # php as fast-cgi enabled # For config options see: http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html <IfModule mod_fcgid.c> IdleTimeout 300 ProcessLifeTime 3600 # MaxProcessCount 1000 DefaultMinClassProcessCount 0 DefaultMaxClassProcessCount 10 IPCConnectTimeout 3 IPCCommTimeout 600 BusyTimeout 3600 </IfModule> <Directory /var/www/nyt.ammenet.dk/web> <FilesMatch "\.php[345]?$"> SetHandler fcgid-script </FilesMatch> FCGIWrapper /var/www/php-fcgi-scripts/web12/.php-fcgi-starter .php FCGIWrapper /var/www/php-fcgi-scripts/web12/.php-fcgi-starter .php3 FCGIWrapper /var/www/php-fcgi-scripts/web12/.php-fcgi-starter .php4 FCGIWrapper /var/www/php-fcgi-scripts/web12/.php-fcgi-starter .php5 Options +ExecCGI AllowOverride All Require all granted </Directory> <Directory /var/www/clients/client0/web12/web> <FilesMatch "\.php[345]?$"> SetHandler fcgid-script </FilesMatch> FCGIWrapper /var/www/php-fcgi-scripts/web12/.php-fcgi-starter .php FCGIWrapper /var/www/php-fcgi-scripts/web12/.php-fcgi-starter .php3 FCGIWrapper /var/www/php-fcgi-scripts/web12/.php-fcgi-starter .php4 FCGIWrapper /var/www/php-fcgi-scripts/web12/.php-fcgi-starter .php5 Options +ExecCGI AllowOverride All Require all granted </Directory> # add support for apache mpm_itk <IfModule mpm_itk_module> AssignUserId web12 client0 </IfModule> <IfModule mod_dav_fs.c> # Do not execute PHP files in webdav directory <Directory /var/www/clients/client0/web12/webdav> <ifModule mod_security2.c> SecRuleRemoveById 960015 SecRuleRemoveById 960032 </ifModule> <FilesMatch "\.ph(p3?|tml)$"> SetHandler None </FilesMatch> </Directory> DavLockDB /var/www/clients/client0/web12/tmp/DavLock # DO NOT REMOVE THE COMMENTS! # IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE! # WEBDAV BEGIN # WEBDAV END </IfModule> </VirtualHost>
The vhost file looks fine. Maybe apache is hanging in a way that it rejects t load any new config, this is rare but it can happen. Either stop apache and then check with ps if there are o more apache processes or restart the whole server to ensure that this is not the problem.
I have restarted apache and even the server countless of times - been hacking at this for 3 or 4 days now The only things I can see that might be relevant: 1) The DNS for the main server is at another ip: nyt.ammenet.dk and www.ammenet.dk have different ips as I'm testing out a new server before moving the main site. 2) This only happens with subdomains. I have 3 other domains that are working perfectly. 3) I dabbled around with letsencrypt and might have broken something. I deleted most of the certs, but I don't really know how to troubleshoot this.
Code: root@vps:/etc# apache2ctl -S AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/apache2/sites-enabled/000-ispconfig.conf:69 VirtualHost configuration: *:8081 vps.mortenholmstrup.dk (/etc/apache2/sites-enabled/000-apps.vhost:9) *:8080 vps.mortenholmstrup.dk (/etc/apache2/sites-enabled/000-ispconfig.vhost:9) *:80 is a NameVirtualHost default server maisha.dk (/etc/apache2/sites-enabled/100-maisha.dk.vhost:7) port 80 namevhost maisha.dk (/etc/apache2/sites-enabled/100-maisha.dk.vhost:7) alias www.maisha.dk port 80 namevhost ny.maisha.dk (/etc/apache2/sites-enabled/100-ny.maisha.dk.vhost:7) port 80 namevhost nyt.ammenet.dk (/etc/apache2/sites-enabled/100-nyt.ammenet.dk.vhost:7) port 80 namevhost visevaerkstedet.dk (/etc/apache2/sites-enabled/100-visevaerkstedet.dk.vhost:7) alias www.visevaerkstedet.dk *:443 maisha.dk (/etc/apache2/sites-enabled/maisha.dk.vhost-le-ssl.conf:8) ServerRoot: "/etc/apache2" Main DocumentRoot: "/var/www/html" Main ErrorLog: "/var/log/apache2/error.log" Mutex mpm-accept: using_defaults Mutex fcgid-pipe: using_defaults Mutex authdigest-opaque: using_defaults Mutex watchdog-callback: using_defaults Mutex rewrite-map: using_defaults Mutex ssl-stapling-refresh: using_defaults Mutex authdigest-client: using_defaults Mutex fcgid-proctbl: using_defaults Mutex ssl-stapling: using_defaults Mutex ssl-cache: using_defaults Mutex default: dir="/var/lock/apache2" mechanism=fcntl PidFile: "/var/run/apache2/apache2.pid" Define: DUMP_VHOSTS Define: DUMP_RUN_CFG Define: ENABLE_USR_LIB_CGI_BIN User: name="www-data" id=33 Group: name="www-data" id=33
I just discovered that varnish is running on the server (can't even remember that I installed it). Could this be doing something?
That was it! Changing the virtualhost to: Code: <VirtualHost *:8888> Fixed it - I am now seeing the correct page. Varnish is listening on port 8888 apparently. One last question: is there any way to integrate ispconfig with varnish so that new sites are automatically assigned this port? Or is it better to make varnish listen to port 80? thanks for all your help and time!