LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-05-2002, 09:07 AM   #1
antken
Member
 
Registered: Nov 2000
Location: england
Distribution: latest Mandrake
Posts: 368

Rep: Reputation: 30
apache V Hosts problem


ok,


i have got apache on a mandrake 8.2 box php4 and all that
when i point my browser at portal
( dns and every thing is set up right )
i get the webpage i want

when i enable virtual hosts i get on every site
403 forbidden

here is how i have configured the Vhosts.conf file
NameVirtualHost *

<VirtualHost *>
User apache
Group apache
ServerName intranet.classicl
DocumentRoot /sites/intranet
</VirtualHost>


any ideas where i have gone wrong?
 
Old 08-05-2002, 09:31 PM   #2
Ionized
Member
 
Registered: Jul 2002
Location: Chicago Suburbs
Distribution: Slackware 8.0
Posts: 51

Rep: Reputation: 15
Well, I've never seen those "wildcard" configurations...here's an example from the web, and I use the same type of configuration for my virtual hosts:

NameVirtualHost 192.168.1.4

<VirtualHost 192.168.1.4>
ServerName madmag.linuxhq.ch
ServerAlias www.linuxhq.ch
DocumentRoot /net/www/virtual/htdocs
ScriptAlias /cgi-bin /net/www/virtual/cgi-bin
TransferLog /net/www/logs/madmag.linuxhq.ch_access
ErrorLog /net/www/logs/madmag.linuxhq.ch_error
</VirtualHost>
 
Old 08-06-2002, 05:03 AM   #3
antken
Member
 
Registered: Nov 2000
Location: england
Distribution: latest Mandrake
Posts: 368

Original Poster
Rep: Reputation: 30
thanks for that

i put that in to my vhosts.conf file and only the last entry worked
but then i had a look through the config files

in commonhttpd.conf there was a section that went somthing like this:

<directory />
order deny,allow
deny from all

something said to me that that does not look right ( if there are any apache gurus out there please feel free to correct me at any time! )

any who, i took this out and went in to the http.conf file
i moved the virtual host config file include line from the middle of the file to the end. and took out some unused include lines and disabled the virtual host alias module and it all seems to work now.

btw i got the wildcard config from the apache docs on the apache.org website, ( i think )


Thanks
 
Old 08-06-2002, 05:07 AM   #4
rverlander
Member
 
Registered: May 2002
Distribution: A few
Posts: 488

Rep: Reputation: 30
try this:

NameVirtualHost your.ip.addy

<VirtualHost localhost>
ServerName localhost
</VirtualHost>
<VirtualHost domain.name>
ServerName www.madmag.linuxhq.ch
DocumentRoot /dev/null
</VirtualHost>

You cant have virtualhosts running on different groups/users
 
Old 08-06-2002, 05:08 AM   #5
rverlander
Member
 
Registered: May 2002
Distribution: A few
Posts: 488

Rep: Reputation: 30
Btw you ALWAYS have to have a dummy virtualhost as the first one
 
Old 08-06-2002, 05:28 AM   #6
antken
Member
 
Registered: Nov 2000
Location: england
Distribution: latest Mandrake
Posts: 368

Original Poster
Rep: Reputation: 30
thanks,

i will try that in a moment, can i ask why there should be a dummy server as the first entry?

at first i thought that the forbidden thing was something to do with a particular user, but it was just the configuration.

just a quick note how would i go about using the virtual host thing with two ip addresses? bascally this server will be a webserver hosting both the intranet and the website and it will have a proper internet ip address and an internal ip address, how would i go about doing this in the config file?
( for example, say my internal ip address is 192.0.0.1 and my external is 1.2.3.4 )

thanks once again
 
Old 08-06-2002, 05:48 AM   #7
rverlander
Member
 
Registered: May 2002
Distribution: A few
Posts: 488

Rep: Reputation: 30
for 2 ips example:

<VirtualHost 127.0.0.1>
ServerName 127.0.0.1
DocumentRoot /dev/null
</VirtualHost>
<VirtualHost 127.0.0.2>
ServerName 127.0.0.2
DocumentRoot /dev/null
</VirtualHost>
 
Old 08-06-2002, 05:49 AM   #8
rverlander
Member
 
Registered: May 2002
Distribution: A few
Posts: 488

Rep: Reputation: 30
oops use this instead:

<VirtualHost 127.0.0.1>
ServerName www.domain.com
DocumentRoot /dev/null
</VirtualHost>
<VirtualHost 127.0.0.2>
ServerName www.domain2.com
DocumentRoot /dev/null
</VirtualHost>
 
Old 08-06-2002, 08:49 AM   #9
RAMILLY
LQ Newbie
 
Registered: Jan 2002
Location: Philippines
Posts: 6

Rep: Reputation: 0
try using this

<virtualhost place your preferred ip address here:80>
DocumentRoot /your path
ScriptAlias /your path
TransferLog /your path
ErrorLog /your path
</VirtualHost>

then you have to give a 775 access to document root path

chmod 755 /index.html directory

this should work.... i have 13 virtual addresses on my linux box and everything works fine.... email me at ramil@dilg.gov.ph...i seldom check the forum box
 
Old 08-13-2002, 07:28 AM   #10
antken
Member
 
Registered: Nov 2000
Location: england
Distribution: latest Mandrake
Posts: 368

Original Poster
Rep: Reputation: 30
i have found out that if you are serving from multiple ip addresses you should do this:

NameVirtualHost 192.168.1.1 ## ip address 1 ( internal )
NameVirtualHost 111.22.33.55 ## ip address 2 ( external )

<VirtualHost 192.168.1.1 111.22.33.55> # this address will serve both internal and external
DocumentRoot /www/server1
ServerName server1.domain.tld
ServerAlias server1
...
</VirtualHost>



<VirtualHost 111.22.33.55> # this address will serve the external only!
DocumentRoot /www/server1
ServerName server2.domain.tld
ServerAlias server1
...
</VirtualHost>


and this seems to work!
 
Old 08-19-2002, 07:48 AM   #11
xylum
LQ Newbie
 
Registered: Aug 2002
Posts: 13

Rep: Reputation: 0
Here is a small reminder for peeps who are having probs setting this up. I'm very very new to linux and here is where my prob was found. For my DocumentRoot line in the vhost file i had the dir in lowercase. When i created the dir it was in upper case. Not knowing that linux was case sensitive my vhosts would never work. Just a reminder if your a newbie like myself it only took 3 days of reading to figure that out. A small point that no one has mentioned before.
 
Old 08-19-2002, 08:46 AM   #12
antken
Member
 
Registered: Nov 2000
Location: england
Distribution: latest Mandrake
Posts: 368

Original Poster
Rep: Reputation: 30
Thumbs up

Good pointer...

also i suggest:

checking if apache has permission to the file you want to serve
( lookup chmod and chown in any good linux book or website i suggest www.tldp.org ( the linux documentation project ) )

if you are running any cgi scripts like .pl or .sh make sure the shebang ( the first line of the file ) points to the correct program


correct me if i am wrong on this one, but i also suggest that you donot include a / at the end of the DocumentRoot directive, this can make you go round in circles for a while cos apache does not like it!
 
Old 08-20-2002, 10:43 PM   #13
rverlander
Member
 
Registered: May 2002
Distribution: A few
Posts: 488

Rep: Reputation: 30
They need dummy ones though
 
  


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 hosts Henster Linux - Software 1 07-24-2005 06:24 AM
Hosts file and Apache elyk Slackware 4 06-06-2005 11:12 PM
Virtual Hosts with Apache noripcord7 Linux - Games 1 02-22-2004 11:33 PM
Problem with Apache Virtual Hosts jaberwooky Linux - Software 4 09-23-2003 02:37 PM
Apache/Virtual Hosts Help C-Squared Linux - General 9 08-04-2003 01:45 PM


All times are GMT -5. The time now is 12:53 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration