LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   vhost in apache (https://www.linuxquestions.org/questions/linux-networking-3/vhost-in-apache-286859/)

jelgavchik 02-06-2005 06:26 AM

vhost in apache
 
Hello.
First i will explain the structure of my small home lan. So i have router which is also a firewall and a real ip asigned to it for ext eth0 + internal eth1 and 192.168.1.1 ip asigned to it. Now i have domain register to my external ip - domain.com. But now the problem is that i run apache server on one of machines on my internal lan with ip 192.168.1.10. I have configured iptables script on my router so everything works fine, i can browse ''mydomain.com'' from my internal newtwork and people from internet can do. But i want to run virtual hosts for example "harmonyofsoul.mydomain.com" (this subdomain is registered also to my external addresse) on the same apache and on the same interface with ip 192.168.1.10. When i do this in the right section of my httpd.conf, and restarted the server i still get what i have in my /var/www/htdocs

This is what i write in my httpd.con:

NameVirtualHost 192.168.1.10:80

<VirtualHost 192.168.1.10:80>
DocumentRoot /var/www/harmonyofsoul
ServerName harmonyofsoul.mydomain.com
</VirtualHost>

Still no result am getting what i have in my /var/www/htdocs

How can i fix this problem?

odious1 02-06-2005 08:26 PM

I don't know, this looks like it should work unless someone is adding WWW to the name, in which case Apache will not know what to do unless you use the ServerAlias in httpd.conf.

Just a thought.

KimVette 02-07-2005 02:29 PM

Which distribution do you have? You may need to add this to your vhost configuration if you're getting an "access forbidden" error:

<Directory "/">
AllowOverride All
order deny,allow
</Directory>


and you may need to add this (listen.conf if you're running Suse, some distributions have it right in httpd.conf) if httpd is simply not responding:

Listen 192.168.1.10:80

this213 02-07-2005 06:41 PM

This is what I have for a dedicated web server (RHL 9 && modified to your info):
Code:

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "/var/www/harmonyofsoul"
ServerName harmonyofsoul.mydomain.com
  <Directory "/var/www/harmonyofsoul/">
    DirectoryIndex index.cgi index.php index.shtml index.html index.htm index.html.var
    Options MultiViews +Includes
    Allow from all
  </Directory>
  ErrorLog /var/log/httpd/error.log
  CustomLog /var/log/httpd/logs/access.log combined
</VirtualHost>

and:
Listen 80

This binds to all available IP addresses (let DNS handle the rest - if you need that)

HTH
This


All times are GMT -5. The time now is 06:35 PM.