Forum Moderators: phranque

Message Too Old, No Replies

VHosts Apache

         

velcis

2:10 am on Oct 3, 2010 (gmt 0)

10+ Year Member



Well, i really need a thing like a webhosting.

I try to add Virtual Hosts in apache but i have one only phisical address, i tried to put on domain like:

EG:

domain1.com ---> /var/www/html/domain1
domain2.com ---> /var/www/html/domain2

Like this, but when i put on httpd conf it redirect all domains to the first virtual host.

Is there any possibilities to apache detect the domain name and stand it folder?

I'm using CentOS , based Apache2 + PHP + MySQL

Thanks for all.

jdMorgan

2:33 am on Oct 3, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Most likely, your <VirtualHost> containers or your NameVirtualHost directives had incorrect syntax, misspellings, or incorrect hostnames specified.

If Apache cannot find a match for a requesed hostname, then it uses the first VirtualHost container as the default. Ideally, this first VirtualHost container *should not* define a "real" hostname -- You should use it only to catch "bad" hostname requests to your name-based server.

See the Apache Virtual Hosts [httpd.apache.org] tutorials at Apache.org.

Jim

velcis

2:44 am on Oct 3, 2010 (gmt 0)

10+ Year Member



When i put NameVirtualHosts *, it gets a syntax error in terminal.

My Virtual.conf

<virtualhost *>
ServerName carlos.com
ServerAlias carlos.com
DocumentRoot "/var/www/html/painel"
<Directory "var/www/html/painel">
allow from all
Options +Indexes
</Directory>
</virtualhost>
<virtualhost *>
ServerName velcis.com
ServerAlias velcis.com
DocumentRoot "/var/www/html/cs"
<Directory "/var/www/html/cs">
allow from all
Options +Indexes
</Directory>
</virtualhost>


Anything incorrect?

velcis

2:48 am on Oct 3, 2010 (gmt 0)

10+ Year Member



Oh, guys i solved it.
I but in NameVirtualHosts 10.1.1.103 <-- My local ip address.

And the virtualhosts 10.1.1.103 Too.

Thanks ;D

velcis

2:52 am on Oct 3, 2010 (gmt 0)

10+ Year Member



And, how can i fix the domain name. Cause i get a redirect like this.

domain1.com/domain1

I should be domain1.com ?

:D

DONE cause the script has a REFRESH thansk *-*