ISPConfig Default Website

Discussion in 'General' started by FeraTechInc, Aug 28, 2012.

  1. Stokesy

    Stokesy Member

    I'm gonna make this a new topic as it clearly doesn't belong here - my apologies...
     
  2. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    again, reload or restart apache.
    check in /etc/apache2/sites-available, see if the domains vhost configuration files have a .err extension.
     
  3. Stokesy

    Stokesy Member

    I have got the new site working after some fiddling with apache but if a domain can't be found on the server the default site is still /var/www/html despite me having set up a new one starting with 000. And if I i put https before it, it still defaults to the next domain alphabetically... confusing
     
  4. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    on the cli, type in a2dissite - do not actually disable anything. post here whatever it gives as options for 'your choices are'

    also post here what files are listed in /etc/apache2/sites-available as a result of 'ls *.conf'

    also give the filename of this default site you've created in ispconfig, and post the contents of that file as well.
     
  5. Stokesy

    Stokesy Member

    sorry only just seen this...
    a2dissite: Your choices are: 000-default 000-ispconfig darlingkhanonline.com.vhost-le-ssl
    ls *.conf: 000-default.conf darlingkhanonline.com.vhost-le-ssl.conf default-ssl.conf ispconfig.conf schoolofmovementmedicine.com.vhost-le-ssl.conf
    default site: 00000-defaultsite.tld - no conf file for that just a vhost file. Don't quite understand why only a few of the sites have a corresponding -le-ssl.conf file and what the function of this is. I recently had to remove one as it was interfering with the functioning of the corresponding site...
    I have just added another site and though it works with https it redirects to the default site (not 000-defaultsite.tld) though I did tick the SSL and letsencrypt boxes when setting up the site and this is working on other older sites...
    Getting more and more puzzled...
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    If you have any vhost files with le-ssl in its name in sites-enabled, then you must have used certbot manually on the shell which breaks the apache config and causes all kinds or errors from routing traffic to wrong sites to not starting apache at all anymore. Remove all such files and enable LE in ISPConfig for the sites instead.
     
  7. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    ok. 00000-defaultsite.tld should be the first site displayed if a requested domain isn't found.

    is it just a holding/advertising page you want displayed if a site isn't found?
    if so, personally, I would just remove 00000-defaultsite.tld, have 000-default enabled (already is), create a symlink 000-default-ssl.conf to /etc/apache2/sites-available/default-ssl.conf and enable that. and replace index.html in /var/www/html with whatever you want to be displayed.

    I believe the -le-ssl.conf files are created when a letsencrypt cert is requested using a standalone certbot from the cli, and it causes a number of problems. I know I've seen something about that recently in these forums. --- and it looks like Till's confirmed that whilst I was still typing it. :D
     
  8. Stokesy

    Stokesy Member

    thanks guys thats good to know. Have deleted all legacy manually created -le-ssl files and switched on letsencrypt within isp-config on those sites
     
  9. Stokesy

    Stokesy Member

    if i now redirect a http: request to the server that isn't hosted there, i am now getting the 00000-defaultsite.tld site served, if however I use https, I get the original first alphabetical site served up (after a warning that it is insecure)....
     
  10. Yarnell

    Yarnell Member

    Hey, yup I know its an old thread but I seem to have found a solution so I thought I'd post it.

    Step1: Create a fille in the sites-available folder called 000-default.conf
    Code:
    NameVirtualHost *
    <VirtualHost *>
        DocumentRoot /var/www/clients/client1/web1/web
    </VirtualHost>
    Step 2: Enable 000-default and restart apache
    Code:
    a2ensite 000-default
    systemctl reload apache2
    Step3: Check to confirm changes
    Code:
    apache2ctl -S
    Look for *:* (top of list under *:8081) and check to see if the default is set to your primary

    I tested it by adding a cname record (test.domain.ca) in godaddy which was not pointing to anything on my server.
    when i went to test.domain.ca in firefox my primary domain was served.

    ** Edit ** hmmm, tried it in chrome and edge and it diden't seem to work. only works in firefox... weird.

    Hope this helps.
     
    Last edited: May 19, 2021
  11. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Both Apache and nginx show the first website in alphabetic order if nothing else is more exact match. So it should work in any browser. I usually create in ISPConfig Panel website named 0000aaaa.site and put index.html that explains why user ends up on that site. The website does not need to exist in name service. No need to modify any apache config files.
     
    ahrasis likes this.
  12. Yarnell

    Yarnell Member

    Got it... damn you google/microsoft why yall gotta make everything hard... gotta luv firefox :)
    Chrome and Edge were keeping a cache of the redirect, that's why none of my changes were working. After trying your 0000aaaa method I remembered that chrome is horrible for developing with as it keeps a cache of everything. So I tried clearing the cache... that also did not work, so what I did was add this snippet to the .htaccess of the site apache was defaulting too.
    Code:
    RewriteCond %{SERVER_PORT} !^443$ [OR]
    RewriteCond %{HTTP_HOST} !^default.tld$ [NC]
    RewriteRule ^(.*)$ https://primary.tld/$1 [L,R]
    
    This snippets checks the host and the port and then redirects to my primary if its not correct.
    Thanks Taleman
     
    Jesse Norell likes this.
  13. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    in chrome press f12 to open the inspector, switch to the network tab, and then check the 'disable cache' checkbox.
    no more caching of anything whilst the inspector is kept open....
    same in edge now it's basically just a rebranded chrome.
     
    ahrasis and Taleman like this.
  14. Yarnell

    Yarnell Member

    ok ok, nice one, thanks.
     

Share This Page