ISPConfig Default Website

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

  1. FeraTechInc

    FeraTechInc Member HowtoForge Supporter

    When we deactivate the one of our website. The user automatically gets redirected to one of our client sites.

    Is it possible to change this?

    I have tried creating a link named "0" and linked it to our main company site. We placed it in /var/www and /var/www/WWW directories without success.

    Is there any way to change the default site which shows up when a client tries to access a site which doesn't exist or is disabled?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Apache shows the first site in alphabetic order that exists for a specific IP address if no site matches. So if you want to create a default site, you just have to ensure that it is the first one in alphabetic order.

    Create a new site in ispconfig and use as domain name e.g.:

    00000-defaultsite.tld

    The domain name does not have to exist, it just have to be the first one to become the default site.
     
  3. FeraTechInc

    FeraTechInc Member HowtoForge Supporter

    This did not work.

    I also tried doing a redirect for the website that was showing up and the redirect does not work eigther...
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Then you most likely did not select the correct IP address for the site or you did not wait until changes were written to disk. The steps I described abive work for all Linux distributions and setups that have a apache server installed.
     
  5. FeraTechInc

    FeraTechInc Member HowtoForge Supporter

    I had to select the IP address for the site. It now works.

    However, I'm trying to get the redirection to work.

    What do the following mean?

    No Flag
    L
    R
    L,R

    I want to have it redirected to my main company site.

    I have http://www.mysite.com
    I have tried L R and L,R then No Flag.

    Is that not how redirection works?
     
    Last edited: Aug 29, 2012
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Please see apache docs for detailed infor about apache rewrite flags:

    http://httpd.apache.org/docs/current/mod/mod_rewrite.html

    The redirect is done for the domain of the website. As you dont use a real domain for the site, the redirect can not work. You can e.g. add a .htaccess file with a wildcard redirect in the web directory of the site.
     
    Last edited: Aug 29, 2012
  7. FeraTechInc

    FeraTechInc Member HowtoForge Supporter

    From what I gather if I set "No Flags" it should work... It didn't...

    So I just made a quick HTML page.

    HTML:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
    "http://www.w3.org/TR/html4/frameset.dtd">
    <head>
    
    </head>
    
    <frameset rows="100%,*" border="0">
    <frame name="__main" src="http://www.mywebsite.com/"
    noresize frameborder="0">
    <noframes>
    <h2>Your Web browser does not support frames</h2>
    <p>
    Please click the link to visit
    <a href="http://www.mywebsite.com/"> My Website </a>
    directly.
    </p>
    </noframes>
    </frameset>
    
    
    </html>
    It's late I'm tired... It works...

    Posted the page in case anybody else finds it useful.
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    No, it can not work. Please see my explanation in #6 if you want to know why.
     
  9. Stufo76

    Stufo76 New Member

    Hello Till,

    I've done *exactly* what you said, but it doesn't worked for me!

    ISPConfig 3.0.5.4p5
     
  10. Lionheart82

    Lionheart82 Member

    I agree with all of the above but let me tell my thoughts here.
    a) The Web site is intentionally disabled by a moderator -> The user goes into the default site as Apache default behavior is. - I agree
    b) The web site is disabled due to another reason such as bandwidth limitation - The user goes into the default site as Apache default behavior is. - I do NOT agree
    I beleive in such cases ispconfig could redirect the user into a bandwidth page with the specific error message. Such an action could be established by creating a folder in the main web like /web/blocking_pages and the specific host would then point into that page instead of /web/

    What do you believe?
     
  11. Martin K.

    Martin K. New Member

    solution #2 worked forme
     
  12. Aivaras

    Aivaras Member

    How to change page "it works" content? Where is this page in the server? I can't find, where is page
    "It works!"
     
  13. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    Depends on the OS; I think debian has a different default page, so guessing that's something else. Try running 'apachectl -S' and see if it lists a 'Main DocumentRoot' .. if not, look at the 'default server' under port 80, and it'll tell you the config file it's defined in, then check there for the DocumentRoot.
     
  14. Farsus

    Farsus Member

    on debian when looking for it after switch from apache 2.2 to 2.4
    debian apache 2.2 /var/www
    debian apache 2.4 /var/www/html
     
  15. Domi

    Domi New Member

    Hi guys, i know that this topic is old, but yesterday i had the same problem. When i disable a website, the visitor sees the default Apache website. However, if i deactivate a site and the visitor knows the https address, Apache has redirected it to the nearest available https site.

    Because i did not want this, and i modify the file '/etc/apache2/sites-available/000-default.conf' and entered these...
    Code:
    <VirtualHost *:80>
        DocumentRoot /var/www/html
    
        ServerName srv01.domain.tld
        ServerAdmin [email protected]
    
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>
    
    <VirtualHost *:443>
        DocumentRoot /var/www/html
    
        ServerName srv01.domain.tld
        ServerAdmin [email protected]
    
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    
        # SSL Configuration
        SSLEngine On
        SSLProtocol All -SSLv3
        SSLCertificateFile /etc/letsencrypt/live/srv01.domain.tld/cert.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/srv01.domain.tld/privkey.pem
        SSLCACertificateFile /etc/letsencrypt/live/srv01.domain.tld/chain.pem
    </VirtualHost>
    I know that there are better options, but this works on my server :)
     
  16. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    set the correct cert details in 000-default-ssl.conf and enable that.
     
  17. Stokesy

    Stokesy Member

    sorry to re-awaken this post but I have similar problems but worse! I added a new site and when I try to access it from browser, I get the default site (/var/www/html on debian)... I then setup a default site 00000-defaultsite.tld and I still got /var/www/html.
    So 2 problems, why is my site not being directed correctly and why am I not able to change the default.
    Or maybe it's just one - why are my new sites not working?!
    I looked for where to 'select the correct IP address for the site' - the only place I can see is where it says 'IPv4-Address' and this only shows an asterisk in the drop-down.
    I cant find any logs that might show what's happening - the new site's log is empty but an entry for index.html is showing up in /var/log/apache2/access.log.1
    Can you suggest how I can debug this?
    Thanks
    PS the directories and files for the new sites are being created correctly in /etc/apache2 and /var/www
     
  18. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    how did you create 00000-defaultsite.tld? in ispconfig? from the cli?
    if from the cli, there's already a default vhost conf in sites-available, just edit that so that it points to whatever default index.html or index.php or whatever file you want it to use.
    a2ensite that vhost conf file.
    for ssl sites, do the same with the default-ssl vhost conf file, also editing the file to point to the correct certificate files.
    make sure the name for the ssl file is changed to start with 000 so it's found before everything else, the non ssl default file should already be done.

    reload or restart apache.
     
  19. Stokesy

    Stokesy Member

    Hi I created the site with ISPConfig - all the directories and files are in place. It just doesn't work. Any requests just get rerouted to the server default site at /var/www/html :-(
     
  20. Stokesy

    Stokesy Member

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

Share This Page