LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 07-15-2002, 08:29 PM   #1
jonfa
Member
 
Registered: Mar 2001
Location: FL
Posts: 257

Rep: Reputation: 30
apache virtualhost


Hi All,

I have a Redhat 7.2 box with a DSL connection. The ISP dynamically assigns the IP's so the IP changes often. Right now I use DTDNS.com for DNS service to run my website (http://redhatjon.slyip.net). This runs flawlessly, but I want to set up several other websites on the same box, but I am unsure of the parameters required by httpd.conf. Will something like the following work:

NameVirtualHost redhatjon.slyip.net
<VirtualHost 192.168.0.7> # 192.168.0.7 is the IP of the Redhat box with apache running
ServerName redhatjon.slyip.net
DocumentRoot "/var/www/html"
</VirtualHost>

NameVirtualHost someother.slyip.net
<VirtualHost 192.168.0.7>
ServerName someother.slyip.net
DocumentRoot "/var/www/html/someother"
</VirtualHost>

I already have redhatjon.slyip.net specified in the beginning of httpd.conf so does this even need to be in the VirtualHost section? What am I doing wrong? Is this even possible?

--
Jon Faranda
 
Old 07-16-2002, 08:10 AM   #2
te_conway
Member
 
Registered: Apr 2001
Location: MA
Distribution: redhat 7.2
Posts: 182

Rep: Reputation: 30
Yes, this will work provided you setup the domain aliases with your dns service
 
Old 07-16-2002, 03:49 PM   #3
Rashkae
Member
 
Registered: May 2002
Distribution: Slackware
Posts: 125

Rep: Reputation: 15
192.168.*.* is an internal address, unless you you have a firewall port forwading port 80 to your Http Server, people will be unable to accesss your web server from over the internet.

Try this:

NameVirtualhost *

<virtualhost *>
Directives...
</virtualhost>

repeast as needed.

That should configure Apache to use all your active IP addresses as as Name based virtual hosts.
 
Old 07-18-2002, 11:31 AM   #4
Syncrm
Member
 
Registered: Aug 2001
Location: Lansing, Michigan
Distribution: slackware8+
Posts: 472

Rep: Reputation: 30
i have a similar configuration in terms of domains and apache. however, i have never been able to get virtual hosts working correctly.

my network setup is as follows: my domain name is endrium.com, which uses the DNS servers of mydomain.com to point to my IP. however, my cable company blocks port 80, which means that www.endrium.com is forwarded to web.endrium.com:81 from mydomain.com. this is necessary since all requests to port 80 are blocked.

i'm running a firewall with IP MASQ and iptables which forwards all port 81 requests to the machine which apache is residing on. my virtual hosts appear as follows:

NameVirtualHost *

<VirtualHost *>
ServerName web.endrium.com
ServerAdmin root@endrium.com
DocumentRoot /usr/local/apache/htdocs
ErrorLog logs/error_log
CustomLog logs/access_log custom
</VirtualHost>

<VirtualHost 192.168.1.56>
DocumentRoot /usr/local/apache/htdocs
ServerAdmin root@toby.endrium.com
ServerName toby.endrium.com
ErrorLog logs/internal/error_log
CustomLog logs/internal/access_log custom
</VirtualHost>

the weird thing is that the second virtual host works perfectly (as it keeps separate log files for my internal clients. but if i change the first VH to some non-existant docroot, nothing happens and everything goes to the default docroot.

does anyone have any suggestions at all? i've been pulling my hair out over this for some time now and am still unable to find a solution. :-(
 
Old 07-18-2002, 03:50 PM   #5
turnip
Member
 
Registered: Jul 2002
Posts: 143

Rep: Reputation: 15
Ready?

here is the easiest way to do v-hosts
setup one docroot, nuke the v-host entry out of httpd.conf
make your new v-host a sub dir in doc root

then in doc root make a .htaccess file

RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} www.yourvhost.com
RewriteCond %{REQUEST_URI} !path/to/dir/
RewriteRule ^(.*)$ path/to/dir/$1 [L]

put one site in doc root, the other in path/to/dir and you're good to go.
 
Old 08-12-2002, 06:07 PM   #6
xylum
LQ Newbie
 
Registered: Aug 2002
Posts: 13

Rep: Reputation: 0
after i modify my vhost file is there a change i need to make in the http.conf file? ot get vhost to work?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
apache + add a VirtualHost linuxtesting2 Linux - Newbie 2 09-03-2005 03:21 AM
Apache -VirtualHost davidhk Debian 7 08-19-2005 12:33 PM
VirtualHost Apache 2 Problem Chris_K1 Linux - Networking 0 01-25-2005 10:00 AM
Apache & VirtualHost nIMBVS Slackware 2 10-27-2004 03:01 PM
Help with Apache <VirtualHost> please. smakkythecamel Linux - Networking 2 06-12-2003 07:15 PM


All times are GMT -5. The time now is 12:09 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration