example.com/thread.php?id=100 >>> t100.example.com

Using a single web hosting account to host multiple sites

Postby richardk » Wed Jul 09, 2008 1:49 pm

Do you have a vhost.conf?
Do you have any <VirtualHost>s in any of the Apache configuration files? (Post the one that's relevant to this domain.)

You need something like
Code: Select all
<VirtualHost *:80>
  ServerName   example.com
  ServerAlias  *.example.com

  DocumentRoot /the/path/to/example.com's/document/root
</VirtualHost>
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby rania » Wed Jul 09, 2008 10:35 pm

sorryyyy am late.

Minty wrote:If you have access to some sort of DNS management you want to add an A/AAAA record "*" to your IP address.

If you don't ignore this 'cos I can't help :)


I think this will work when I create a subdomains Folders.

But since I want to use a file variables, I think this won't work for me.

as you know it'll be in httpd.conf something like this :

DocumentRoot /home/examlpe/public_html

which points to nothing. ( as I understood from richardk )

You ment somthing else, didn't you ?

thanks brother. waiting for your response.

richardk wrote:Do you have a vhost.conf?
Do you have any <VirtualHost>s in any of the Apache configuration files? (Post the one that's relevant to this domain.)

You need something like
Code: Select all
<VirtualHost *:80>
  ServerName   example.com
  ServerAlias  *.example.com

  DocumentRoot /the/path/to/example.com's/document/root
</VirtualHost>


yes, I have a httpd.conf which have <VirtualHost> for my domain.
In fact, I found two <VirtualHost>s relevant to my domain ( 'coz I already have a real subdomain but for another script ).
here they are :

the real subdomain :

Code: Select all
<VirtualHost xx.xx.xx.xx:80>
    ServerName pix.example.com
    ServerAlias www.pix.example.com
    DocumentRoot /home/example/public_html/pix
    ServerAdmin webmaster@pix.example.com
    ## User example # Needed for Cpanel::ApacheConf
    <IfModule mod_userdir.c>
        Userdir disabled
        Userdir enabled example
    </IfModule>
    <IfModule mod_suphp.c>
        suPHP_UserGroup example example
    </IfModule>
    <IfModule concurrent_php.c>
        php4_admin_value open_basedir "/home/example:/usr/lib/php:/usr/php4/li$
        php5_admin_value open_basedir "/home/example:/usr/lib/php:/usr/local/l$
    </IfModule>
    <IfModule !concurrent_php.c>
        <IfModule mod_php4.c>
            php_admin_value open_basedir "/home/example:/usr/lib/php:/usr/php4$
        </IfModule>
        <IfModule mod_php5.c>
            php_admin_value open_basedir "/home/example:/usr/lib/php:/usr/loca$
        </IfModule>
        <IfModule sapi_apache2.c>
            php_admin_value open_basedir "/home/example:/usr/lib/php:/usr/php4$
        </IfModule>
    </IfModule>
    <IfModule !mod_disable_suexec.c>
        SuexecUserGroup example example
    </IfModule>
    CustomLog /usr/local/apache/domlogs/pix.example.com-bytes_log "%{%s}t %I .$
    CustomLog /usr/local/apache/domlogs/pix.example.com combined
    ScriptAlias /cgi-bin/ /home/example/public_html/pix/cgi-bin/
    # To customize this VirtualHost use an include file at the following locati$
    # Include "/usr/local/apache/conf/userdata/example/pix.example.com/*.conf"
</VirtualHost>


the ... whatever :

Code: Select all
<VirtualHost xx.xx.xx.xx:80>
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /home/example/public_html
    ServerAdmin webmaster@example.com
    UseCanonicalName Off
    CustomLog /usr/local/apache/domlogs/example.com combined
    CustomLog /usr/local/apache/domlogs/example.com-bytes_log "%{%s}t %I .\n%{$
    ## User example # Needed for Cpanel::ApacheConf
    UserDir disabled
    UserDir enabled example
    <IfModule concurrent_php.c>
        php4_admin_value open_basedir "/home/example:/usr/lib/php:/usr/php4/li$
        php5_admin_value open_basedir "/home/example:/usr/lib/php:/usr/local/l$
    </IfModule>
    <IfModule !concurrent_php.c>
        <IfModule mod_php4.c>
            php_admin_value open_basedir "/home/example:/usr/lib/php:/usr/php4$
        </IfModule>
        <IfModule mod_php5.c>
            php_admin_value open_basedir "/home/example:/usr/lib/php:/usr/loca$
        </IfModule>
        <IfModule sapi_apache2.c>
            php_admin_value open_basedir "/home/example:/usr/lib/php:/usr/php4$
        </IfModule>
    </IfModule>
    <IfModule !mod_disable_suexec.c>
        SuexecUserGroup example example
    </IfModule>
    ScriptAlias /cgi-bin/ /home/example/public_html/cgi-bin/


    # To customize this VirtualHost use an include file at the following locati$
    # Include "/usr/local/apache/conf/userdata/example/example.com/*.conf"
</VirtualHost>


Is that what do you mean ?
rania
 
Posts: 7
Joined: Sun Jun 29, 2008 12:46 pm

Postby richardk » Sun Jul 13, 2008 10:17 am

Try replacing this line (in the second <VirtualHost>)
Code: Select all
ServerAlias www.example.com

with
Code: Select all
ServerAlias *.example.com


I think this will work when I create a subdomains Folders.

But since I want to use a file variables, I think this won't work for me.

as you know it'll be in httpd.conf something like this :

DocumentRoot /home/examlpe/public_html

which points to nothing. ( as I understood from richardk )

You ment somthing else, didn't you ?

thanks brother. waiting for your response.

He is talking about DNS. It is totally seperate from Apache. DNS is how the browser finds the IP address of the server using the (sub) domain (t001.example.com). It is the same from all sub domains and domains. If your DNS is wrong you will get a timeout error from your browser when you try to connect to them. More information: Domain Name System.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Previous

Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 24 guests

cron