Virtual host you. com not working

Discussion in 'Installation/Configuration' started by brisk, Sep 14, 2017.

  1. brisk

    brisk Member

    So I have a domain start with 'you', created a site it always resolves back to the last virtual host. But dummy. com is fine.


    There is what I did:

    1: In ISPConfig 3.1, create two websites, minimal information, site names you dot com dummy dot com
    2: Change windows' hosts file to make sure www.you. com and www.dummy. com resolve to my server ip
    3: Open browser (chrome or ff), type in link www.dummy. com, it will display the default welcome page.
    4: Type link www.you dot com, it will display the last virtual host you added, not the default welcome page.

    So looks like apache2 cannot read the vhost file of you dot com, but I did a diff of these two conf files, I don't see any issue.

    What is wrong?
     
  2. brisk

    brisk Member

    sorry the site doesn't allow me to post .com, so I had to add space or replace it with dot, but you have the idea..
     
  3. brisk

    brisk Member

    and here is the apache2ctl configtest result:

     
  4. HSorgYves

    HSorgYves Active Member HowtoForge Supporter

    Post the output of: apache2ctl -S
     
  5. brisk

    brisk Member

    So did a
    basically, it displays the default site, not the welcome page from the you.com's virtual host
     
  6. brisk

    brisk Member

    Code:
    AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/apache2/sites-enabled/000-ispconfig.conf:72
    VirtualHost configuration:
    173.208.xxx.xxx:443    is a NameVirtualHost
             default server a1234567.com (/etc/apache2/sites-enabled/100-a1234567.com.vhost:176)
             port 443 namevhost a1234567.com (/etc/apache2/sites-enabled/100-a1234567.com.vhost:176)
                     alias www.a1234567.com
             port 443 namevhost another123.com (/etc/apache2/sites-enabled/100-another123.com.vhost:176)
                     alias www.another123.com
             port 443 namevhost csomething.com (/etc/apache2/sites-enabled/100-csomething.com.vhost:175)
                     alias www.csomething.com
             port 443 namevhost t12345.com (/etc/apache2/sites-enabled/100-t12345.com.vhost:176)
                     alias www.t12345.com
             port 443 namevhost t2345.com (/etc/apache2/sites-enabled/100-t2345.com.vhost:175)
                     alias www.t2345.com
    173.208.xxx.xxx:80     is a NameVirtualHost
             default server a1234567.com (/etc/apache2/sites-enabled/100-a1234567.com.vhost:7)
             port 80 namevhost a1234567.com (/etc/apache2/sites-enabled/100-a1234567.com.vhost:7)
                     alias www.a1234567.com
             port 80 namevhost another123.com (/etc/apache2/sites-enabled/100-another123.com.vhost:7)
                     alias www.another123.com
             port 80 namevhost csomething.com (/etc/apache2/sites-enabled/100-csomething.com.vhost:7)
                     alias www.csomething.com
             port 80 namevhost dummy.com (/etc/apache2/sites-enabled/100-dummy.com.vhost:7)
                     alias www.dummy.com
             port 80 namevhost t12345.com (/etc/apache2/sites-enabled/100-t12345.com.vhost:7)
                     alias www.t12345.com
             port 80 namevhost t2345.com (/etc/apache2/sites-enabled/100-t2345.com.vhost:7)
                     alias www.t2345.com
             port 80 namevhost you123.com (/etc/apache2/sites-enabled/100-you123.com.vhost:7)
                     alias www.you123.com
    *:8081                 server1.ti45678.com (/etc/apache2/sites-enabled/000-apps.vhost:9)
    *:8080                 server1.ti45678.com (/etc/apache2/sites-enabled/000-ispconfig.vhost:9)
    *:80                   is a NameVirtualHost
             default server server1.ti45678.com (/etc/apache2/sites-enabled/000-default.conf:1)
             port 80 namevhost server1.ti45678.com (/etc/apache2/sites-enabled/000-default.conf:1)
             port 80 namevhost you.com (/etc/apache2/sites-enabled/100-you.com.vhost:7)
                     alias www.you.com
             port 80 namevhost you1231.comn (/etc/apache2/sites-enabled/100-you1231.com.vhost:7)
                     alias www.you1231.comn
    ServerRoot: "/etc/apache2"
    Main DocumentRoot: "/var/www/html"
    Main ErrorLog: "/var/log/apache2/error.log"
    Mutex fcgid-proctbl: using_defaults
    Mutex ssl-stapling: using_defaults
    Mutex proxy: using_defaults
    Mutex ssl-cache: using_defaults
    Mutex default: dir="/var/run/apache2/" mechanism=default
    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
    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
    root@server1:/var/log#
    
     
  7. brisk

    brisk Member

    and this is the content of the vhost file:

    you.com

    Code:
    root@server1:/var/log# more /etc/apache2/sites-enabled/100-you.com.vhost
    
    <Directory /var/www/you.com>
                    AllowOverride None
                                    Require all denied
                    </Directory>
    
    <VirtualHost *:80>
    
                                                                            DocumentRoot /var/www/you.com/web
    
                    ServerName you.com
                    ServerAlias www.you.com
                    ServerAdmin [email protected]
    
                    ErrorLog /var/log/ispconfig/httpd/you.com/error.log
    
                    Alias /error/ "/var/www/you.com/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/you.com/web>
                                    # Clear PHP settings of this website
                                    <FilesMatch ".+\.ph(p[345]?|t|tml)$">
                                                    SetHandler None
                                    </FilesMatch>
                                    Options +FollowSymLinks
                                    AllowOverride All
                                                                    Require all granted
                                                                    <Files ~ '.php[s3-6]{0,1}$'>
                                                                                                    Require all denied
                                                                                    </Files>
                    </Directory>
                    <Directory /var/www/clients/client1/web14/web>
                                    # Clear PHP settings of this website
                                    <FilesMatch ".+\.ph(p[345]?|t|tml)$">
                                                    SetHandler None
                                    </FilesMatch>
                                    Options +FollowSymLinks
                                    AllowOverride All
                                                                    Require all granted
                                                                    <Files ~ '.php[s3-6]{0,1}$'>
                                                                                    Require all denied
                                                                            </Files>
                    </Directory>
    
    
    
    
                    # suexec enabled
                    <IfModule mod_suexec.c>
                            SuexecUserGroup web14 client1
                    </IfModule>
    
    
    
                    # add support for apache mpm_itk
                    <IfModule mpm_itk_module>
                            AssignUserId web14 client1
                    </IfModule>
    
                    <IfModule mod_dav_fs.c>
                    # Do not execute PHP files in webdav directory
                            <Directory /var/www/clients/client1/web14/webdav>
                                    <ifModule mod_security2.c>
                                            SecRuleRemoveById 960015
                                            SecRuleRemoveById 960032
                                    </ifModule>
                                    <FilesMatch "\.ph(p3?|tml)$">
                                            SetHandler None
                                    </FilesMatch>
                            </Directory>
                            DavLockDB /var/www/clients/client1/web14/tmp/DavLock
                            # DO NOT REMOVE THE COMMENTS!
                            # IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE!
          # WEBDAV BEGIN
                            # WEBDAV END
                    </IfModule>
    
    
    
    </VirtualHost>
    
     
  8. brisk

    brisk Member

    and dummy:

    Code:
    root@server1:/var/log# cat /etc/apache2/sites-enabled/100-dummy.com.vhost
    
    <Directory /var/www/dummy.com>
                    AllowOverride None
                                    Require all denied
                    </Directory>
    
    <VirtualHost 173.208.166.171:80>
    
                                                                            DocumentRoot /var/www/dummy.com/web
    
                    ServerName dummy.com
                    ServerAlias www.dummy.com
                    ServerAdmin [email protected]
    
                    ErrorLog /var/log/ispconfig/httpd/dummy.com/error.log
    
                    Alias /error/ "/var/www/dummy.com/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/dummy.com/web>
                                    # Clear PHP settings of this website
                                    <FilesMatch ".+\.ph(p[345]?|t|tml)$">
                                                    SetHandler None
                                    </FilesMatch>
                                    Options +FollowSymLinks
                                    AllowOverride All
                                                                    Require all granted
                                                                    <Files ~ '.php[s3-6]{0,1}$'>
                                                                                                    Require all denied
                                                                                    </Files>
                    </Directory>
                    <Directory /var/www/clients/client1/web12/web>
                                    # Clear PHP settings of this website
                                    <FilesMatch ".+\.ph(p[345]?|t|tml)$">
                                                    SetHandler None
                                    </FilesMatch>
                                    Options +FollowSymLinks
                                    AllowOverride All
                                                                    Require all granted
                                                                    <Files ~ '.php[s3-6]{0,1}$'>
                                                                                    Require all denied
                                                                            </Files>
                    </Directory>
    
    
    
    
                    # suexec enabled
                    <IfModule mod_suexec.c>
                            SuexecUserGroup web12 client1
                    </IfModule>
    
    
    
                    # add support for apache mpm_itk
                    <IfModule mpm_itk_module>
                            AssignUserId web12 client1
                    </IfModule>
    
                    <IfModule mod_dav_fs.c>
                    # Do not execute PHP files in webdav directory
                            <Directory /var/www/clients/client1/web12/webdav>
                                    <ifModule mod_security2.c>
                                            SecRuleRemoveById 960015
                                            SecRuleRemoveById 960032
                                    </ifModule>
                                    <FilesMatch "\.ph(p3?|tml)$">
                                            SetHandler None
                                    </FilesMatch>
                            </Directory>
                            DavLockDB /var/www/clients/client1/web12/tmp/DavLock
                            # DO NOT REMOVE THE COMMENTS!
                            # IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE!
          # WEBDAV BEGIN
                            # WEBDAV END
                    </IfModule>
    
    
    
    </VirtualHost>
    
     
  9. HSorgYves

    HSorgYves Active Member HowtoForge Supporter

    How do you check if you see the contents of
    /var/www/clients/client1/web14/web
    or something else when accessing the site?
     
  10. brisk

    brisk Member

    web14 is you.com, it has default welcome page from ispconfig.

    The default site is fully populated, so it is not the default welcome page.

    I modified my Windows's hosts file, so on my windows if I type in http://www.you.com, it should show the default welcome page, but it shows the default site is the fully populated one.

    However if I do the exact same same for dummy.com, it shows ispconfig's default welcome page (which is correct).
     
  11. HSorgYves

    HSorgYves Active Member HowtoForge Supporter

    Try to assign an IP to you.com
     
  12. brisk

    brisk Member

    Thanks, added ip fixed you.com problem, but my other site (you123.com in post #6), which already has ip there, it still resolves to default site :(
     
  13. HSorgYves

    HSorgYves Active Member HowtoForge Supporter

    It should work with * as well, make a modification and save you123.com again, so that the files are regenerated.
     
  14. brisk

    brisk Member

    hmm still the same.

    So I moved sites-enabled to a different name, and created an empty folder sites-enabled, and http://www.you.com or other sites resolves to this: (still http)
    But http://www.you123.com got redirected to https//:www.you123.com and displays:

    I should mention that first time I created you123.com I did 3 things in ISPConfig very shortly, I first created a site, did not wait until it is done, then added DNS for the site, again, didn't wait then added email domain, that is how I found the issue. Could be something messed up if I do the above tasks without waiting for the previous ones to finish?

    And this is the output of apachectl -s:

     
    Last edited: Sep 15, 2017
  15. HSorgYves

    HSorgYves Active Member HowtoForge Supporter

    You have no sites left as you "deleted" the folder sites-enabled. Everything points to /var/www/html now.
     
  16. brisk

    brisk Member

    Yes understood, that is why other sites resolve to "it works page". So something is strange since all sites are done, you123.com should display 'it works' page too, but it didn't, it redirect to a https. I just added other sites back, and deleted you123.com conf from sitesenabled forlder and now when I visit http://www.you123.com, it redirects to https://www.you123.com, and then the default site which happened to be the last working site I had.

    So why it redirects to https even the site is deleted? I searched the key "123" in /etc/apache2 folder, no matches.

    thanks
     
  17. HSorgYves

    HSorgYves Active Member HowtoForge Supporter

    Have you restarted apache?
     
  18. brisk

    brisk Member

    Yes, I restarted apache2 many times.....
     

Share This Page