Sub domains/co-domains

Discussion in 'Installation/Configuration' started by terryoleary1981, May 9, 2008.

  1. terryoleary1981

    terryoleary1981 New Member

    Hi all

    I'm trying to set up a sub domain for a site like admin.mydomain.co.uk the main site mydomain.co.uk works but if i try to access the admin.mydomain.co.uk a 404 error comes up. I've set up the co domain to forward to a folder on the server called admin (within the web directory of the domain) and ticked the DNS record box. When i browse to mydomain.co.uk/admin i can see the site...

    I think i've missed something on the setup?
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Can you post the vhost configuration of that web site?
     
  3. terryoleary1981

    terryoleary1981 New Member

    see below.

    <VirtualHost 192.168.1.108:80>
    SSLCertificateChainFile /var/www/web1/ssl/gd_intermediate_bundle.crt
    ServerName www.thisdomain.co.uk:80
    ServerAdmin [email protected]
    DocumentRoot /var/www/web1/web
    ServerAlias thisdomain.co.uk thisdomain.es admin.thisdomain.co.uk
    DirectoryIndex index.html index.htm index.php index.php5 index.php4 index.php3 index.shtml index.cgi index.pl index.jsp Default.htm default.htm
    ScriptAlias /cgi-bin/ /var/www/web1/cgi-bin/
    AddHandler cgi-script .cgi
    AddHandler cgi-script .pl
    ErrorLog /var/www/web1/log/error.log
    AddType application/x-httpd-php .php .php3 .php4 .php5
    <Files *.php>
    SetOutputFilter PHP
    SetInputFilter PHP
    </Files>
    <Files *.php3>
    SetOutputFilter PHP
    SetInputFilter PHP
    </Files>
    <Files *.php4>
    SetOutputFilter PHP
    SetInputFilter PHP
    </Files>
    <Files *.php5>
    SetOutputFilter PHP
    SetInputFilter PHP
    </Files>
    php_admin_flag safe_mode Off
    Alias /error/ "/var/www/web1/web/error/"
    ErrorDocument 400 /error/invalidSyntax.html
    ErrorDocument 401 /error/authorizationRequired.html
    ErrorDocument 403 /error/forbidden.html
    ErrorDocument 404 /error/fileNotFound.html
    ErrorDocument 405 /error/methodNotAllowed.html
    ErrorDocument 500 /error/internalServerError.html
    ErrorDocument 503 /error/overloaded.html
    AliasMatch ^/~([^/]+)(/(.*))? /var/www/web1/user/$1/web/$3
    AliasMatch ^/users/([^/]+)(/(.*))? /var/www/web1/user/$1/web/$3
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^admin\.thisdomain\.co\.uk [NC]
    RewriteRule ^/(.*)$ http://www.thisdomain.co.uk/admin$1 [R]
    </VirtualHost>
    #
    <IfModule mod_ssl.c>
    <VirtualHost 192.168.1.108:443>
    SSLCertificateChainFile /var/www/web1/ssl/gd_intermediate_bundle.crt
    ServerName www.thisdomain.co.uk:443
    ServerAdmin [email protected]
    DocumentRoot /var/www/web1/web
    ServerAlias thisdomain.co.uk thisdomain.es admin.thisdomain.co.uk
    DirectoryIndex index.html index.htm index.php index.php5 index.php4 index.php3 index.shtml index.cgi index.pl index.jsp Default.htm default.htm
    ScriptAlias /cgi-bin/ /var/www/web1/cgi-bin/
    AddHandler cgi-script .cgi
    AddHandler cgi-script .pl
    ErrorLog /var/www/web1/log/error.log
    AddType application/x-httpd-php .php .php3 .php4 .php5
    <Files *.php>
    SetOutputFilter PHP
    SetInputFilter PHP
    </Files>
    <Files *.php3>
    SetOutputFilter PHP
    SetInputFilter PHP
    </Files>
    <Files *.php4>
    SetOutputFilter PHP
    SetInputFilter PHP
    </Files>
    <Files *.php5>
    SetOutputFilter PHP
    SetInputFilter PHP
    </Files>
    php_admin_flag safe_mode Off
    SSLEngine on
    SSLCertificateFile /var/www/web1/ssl/www.thisdomain.co.uk.crt
    SSLCertificateKeyFile /var/www/web1/ssl/www.thisdomain.co.uk.key
    Alias /error/ "/var/www/web1/web/error/"
    ErrorDocument 400 /error/invalidSyntax.html
    ErrorDocument 401 /error/authorizationRequired.html
    ErrorDocument 403 /error/forbidden.html
    ErrorDocument 404 /error/fileNotFound.html
    ErrorDocument 405 /error/methodNotAllowed.html
    ErrorDocument 500 /error/internalServerError.html
    ErrorDocument 503 /error/overloaded.html
    AliasMatch ^/~([^/]+)(/(.*))? /var/www/web1/user/$1/web/$3
    AliasMatch ^/users/([^/]+)(/(.*))? /var/www/web1/user/$1/web/$3
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^admin\.thisdomain\.co\.uk [NC]
    RewriteRule ^/(.*)$ https://www.thisdomain.co.uk/admin$1 [R]
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
    </VirtualHost>
    </IfModule>
    #
     
  4. falko

    falko Super Moderator Howtoforge Staff

  5. terryoleary1981

    terryoleary1981 New Member

  6. falko

    falko Super Moderator Howtoforge Staff

    Does www.thisdomain.co.uk point to the right server? You can check that with
    Code:
    dig www.thisdomain.co.uk
     
  7. terryoleary1981

    terryoleary1981 New Member

  8. falko

    falko Super Moderator Howtoforge Staff

    Then I don't know why you can't access the admin folder... :(
     

Share This Page