LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 08-07-2003, 05:04 PM   #1
klintonray
Member
 
Registered: Apr 2003
Location: Phx, AZ
Posts: 61

Rep: Reputation: 15
Virtual host config won't work


Hey all...

Ok, i'm trying to set up a virtual host for two sites. I have started trying to configure the file for the first one, and no matter what I do. I always get the test page. If you don't know what test page I'm talking about trying looking up my site and you will get it ... http://www.arizonahealthquotes.com ....ok, i'm gonna put my virtual config file down here cause I know that helps you guys. Also the network it set up that the server has an internal ip address of 192.168.1.20, and a public wan address of 63.226.61.140. Thanx guys..you always are a huge help.

#
# Virtual hosts
#

# Virtual host Default Virtual Host
<VirtualHost 63.226.61.140:80>

DocumentRoot /home/klinton/aba/
ServerName www.arizonahealthquotes.com
ServerAlias www.arizonahealthquotes.com








DirectoryIndex index.php index.html index.htm index.shtml






LogLevel debug
HostNameLookups off




</VirtualHost>

thanx again
 
Old 08-07-2003, 06:11 PM   #2
klintonray
Member
 
Registered: Apr 2003
Location: Phx, AZ
Posts: 61

Original Poster
Rep: Reputation: 15
Ok, I just looked through my error files and found this too

[Thu Aug 07 16:08:15 2003] [error] [client 192.168.1.20] Directory index forbidden by rule: /var/www/html/

That happens and it gives me the test page I guess.

I don't know what it means, but I hope you guys can use it.
 
Old 08-07-2003, 07:20 PM   #3
klintonray
Member
 
Registered: Apr 2003
Location: Phx, AZ
Posts: 61

Original Poster
Rep: Reputation: 15
if i change things around to look like this:

# Virtual hosts
#

# Virtual host Default Virtual Host
<VirtualHost *>








DirectoryIndex index.php index.html index.htm index.shtml






LogLevel debug
HostNameLookups off




</VirtualHost>

# Virtual host www.arizonahealthquotes.com
<VirtualHost 192.168.1.20>
DocumentRoot /home/klinton/aba/

ServerAdmin klintonkerber@prodigy.net
ServerName arizonahealthquotes.com


ServerAlias www.arizonahealthquotes.com




<Directory "/home/klinton/aba/">
AllowOverride none
Allow from from all
Deny from from all
Order Allow,Deny
</Directory>

<Directory "/">
AllowOverride none



</Directory>












</VirtualHost>


I get an error message that says i don't have permission to access "/" maybe that will help too
 
Old 08-08-2003, 04:51 AM   #4
haobaba1
Member
 
Registered: Jul 2003
Location: VA Tech
Distribution: Mandrake 9.1
Posts: 73

Rep: Reputation: 15
what version of apache are you using? I Know there are some differences between 1.x and 2.x. I am using apache 2 and it has a seperate configuration file for virtual host in a directory called vhosts. I would look into the differences of named virtual hosts and addressed virtual hosts and think of making all of your hosts virtual and creating a dummy host for the non-virtual host this is what I did and have no problems.
 
Old 08-08-2003, 03:21 PM   #5
klintonray
Member
 
Registered: Apr 2003
Location: Phx, AZ
Posts: 61

Original Poster
Rep: Reputation: 15
I am using apache 2.x .... what do you mean dummy host for the non-virtual host?....could you lay out how you set up your network for me so I could do the same please?

Thanx!
 
Old 08-08-2003, 03:34 PM   #6
hakcenter
Member
 
Registered: Apr 2003
Location: Not to far from the computer screen
Distribution: RedHat 9.0
Posts: 324

Rep: Reputation: 30
I have a 2.x virtual host working..

I made it a seperate config from the httpd.conf..

put it in conf.d/virutalhost.conf


virtualhost.conf
Quote:
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName www.crapper.com
</VirtualHost>
I use a seperate conf.. cause its easier... to manage...
and your httpd picks up *.conf in conf.d anyways :-P
 
Old 08-08-2003, 04:39 PM   #7
klintonray
Member
 
Registered: Apr 2003
Location: Phx, AZ
Posts: 61

Original Poster
Rep: Reputation: 15
That dosn't seem to work for me...when i use that script with my mods like

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /var/www/aba <----the folder I want it to go to
ServerName www.arizonahealthquotes.com
</VirtualHost>

if I put it by itself as a file called virtualhosts.conf or in the actual httpd.conf file....it just points arizonahealthquotes.com to my /var/www/html folder. So I tried putting the folder aba in my /var/www/html folder but it does the same thing. Thanx for the help guys. I feel like ripping my head off, but with your guys' help I'm sure you'll get it figured out.
 
Old 08-08-2003, 04:39 PM   #8
haobaba1
Member
 
Registered: Jul 2003
Location: VA Tech
Distribution: Mandrake 9.1
Posts: 73

Rep: Reputation: 15
ok here are my conf files for my virtual hosts:
note that the namedvirtualhost * is commented out!


httpd2.conf

# this server does nothing and doesn't even resolve.

ServerRoot /etc/httpd/2.0
ServerName dummy.domain.net:80
#LockFile /etc/httpd/httpd.lock
PidFile /var/run/httpd.pid
ErrorLog logs/error_log
LogLevel warn
DocumentRoot /var/www/html/

### Dynamic Shared Object (DSO) Support
###
### You should always leave those three, as they are needed for
### normal use.
### mod_access (Order, Allow, etc..)
### mod_log_config (Transferlog, etc..)
### mod_mime (AddType, etc...)

LoadModule access_module modules/mod_access.so
LoadModule auth_module modules/mod_auth.so
LoadModule auth_anon_module modules/mod_auth_anon.so
##LoadModule auth_dbm_module modules/mod_auth_dbm.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule env_module modules/mod_env.so
##LoadModule mime_magic_module modules/mod_mime_magic.so
##LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule usertrack_module modules/mod_usertrack.so
##LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule proxy_module modules/mod_proxy.so
##LoadModule proxy_connect_module modules/mod_proxy_connect.so
##LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule mime_module modules/mod_mime.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
##LoadModule cgid_module modules/mod_cgid.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imap_module modules/mod_imap.so
LoadModule actions_module modules/mod_actions.so
##LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
##LoadModule optional_fn_import_module modules/mod_optional_fn_import.so
##LoadModule optional_fn_export_module modules/mod_optional_fn_export.so
##LoadModule bucketeer_module modules/mod_bucketeer.so
##LoadModule logio_module modules/mod_logio.so

###
### Global Configuration
###
# We now support multiple apache configurations on the same server. In
# common.conf, we put all directives that are common to all implementations
# (httpd, httpd-perl, etc.)
# For Apache2 we load all conf files in conf.d
Include /etc/httpd/conf.d/*.conf
Include conf/commonhttpd.conf


###
### IP Address/Port and Proxied configuration section
###
# The APACHEPROXIED setting can be set in /etc/rc.d/init.d/httpd if you
# are using a proxy or accelerator, like the Apache-SGI or khttpd, so that
# the fast web server serves static content while Apache handles the
# cgi or php files

#bindaddress *

#NameVirtualHost *
#<VirtualHost *>
# ServerName domain.nett:80
# ServerPath /domain
# DocumentRoot /var/www.html/
#</VirtualHost>

#<VirtualHost *>
# ServerName sub.domain.net:80
# DocumentRoot /var/www/html//sub
#</VirtualHost>


<IfDefine APACHEPROXIED>
Listen 8080
</IfDefine>
<IfDefine !APACHEPROXIED>
Listen 80
</IfDefine>

# Likewise, we can set apache as the server by default and send perl
# requests via ProxyPass to apache-mod_perl. It increases performance
# since the perl interpreter is only used for perl and the standard apache
# does all the html and image files, with a smaller footprint.
#
# If you install apache and apache-mod_perl, this is the default config.
# If you don't want two web servers to use perl, uninstall apache, and
# apache-mod_perl will not be proxied.

<IfDefine PERLPROXIED>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^proxy:.* - [F]
RewriteRule ^(.*\/perl\/.*)$ http://%{HTTP_HOST}:8200$1 [P]
RewriteRule ^(.*\/cgi-perl\/.*)$ http://%{HTTP_HOST}:8200$1 [P]
</IfModule>
</IfDefine>

###
### Log configuration Section
###

<IfModule mod_log_config.c>
#Single logfile with access, agent and referer information
#This is the default, if vlogs are not defined for the main server
CustomLog logs/access_log combined env=!VLOG
#If VLOG is defined in conf/vhosts/Vhost.conf, we use this entry
CustomLog "|/usr/sbin/advxsplitlogfile" vhost env=VLOG
</IfModule>


###
### Virtual Hosts
###
# We include different templates for Virtual Hosting. Have a look in the
# vhosts directory and modify to suit your needs.
Include conf/vhosts/Vhosts.conf
#Include conf/vhosts/DynamicVhosts.conf
#Include conf/vhosts/VirtualHomePages.conf


###
### Performance settings Section
###
#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15


# prefork MPM [THIS IS THE DEFAULT]
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule worker.c>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>

# perchild MPM
# NumServers: constant number of server processes
# StartThreads: initial number of worker threads in each server process
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# MaxThreadsPerChild: maximum number of worker threads in each server process
# MaxRequestsPerChild: maximum number of connections per server process
<IfModule perchild.c>
NumServers 5

<IfModule perchild.c>
NumServers 5
StartThreads 5
MinSpareThreads 5
MaxSpareThreads 10
MaxThreadsPerChild 20
MaxRequestsPerChild 0
</IfModule>

~

***************************************************************
ok here is my Vhosts.conf file which is located in the vhosts directory directly below the httpd2.conf and is included in the httpd2.conf. Note that the ports are specified for each virtual hosts. it must be so.


Vhosts.conf:



################# IP-based Virtual Hosts
#<VirtualHost 192.168.2.100>
#User jmdault
#Group jmdault
#DocumentRoot /home/jmdault/public_html
#ServerName test2.com
#Setenv VLOG /home/jmdault/logs
#ErrorLogs /home/jmdault/test2-error_log
#RewriteEngine On
#RewriteOptions inherit
#</VirtualHost>

################# Named VirtualHosts

NameVirtualHost 204.212.234.150:80
<VirtualHost 204.212.234.150:80>
ServerName domain.net:80
ServerPath /domain
DocumentRoot /var/www/html/
</VirtualHost>

NameVirtualHost 204.212.234.150:80
<VirtualHost 204.212.234.150:80>
ServerName sub1.domain.net:80
ServerPath /domain
DocumentRoot /var/www/html/homepage/
SSLEngine off
</VirtualHost>

NameVirtualHost 204.212.234.150:80
<VirtualHost 204.212.234.150:80>
ServerName sub2.domain.net:80
ServerPath /domain
DocumentRoot /var/www/html/resume/
SSLEngine off

</VirtualHost>




I am not an expert on apache and this may be a technically incorrect configuration and may have security implications that I am unaware of but the most important thing for me is that it works. I believe if you don't specify the ports then it will default to port 443 which is https and will give you wacky certificate problems if you don't have a valid certificate like me.

hope this helps.
 
Old 08-08-2003, 04:49 PM   #9
klintonray
Member
 
Registered: Apr 2003
Location: Phx, AZ
Posts: 61

Original Poster
Rep: Reputation: 15
Wow!! hmmm...ok my verson of apache has no folder named vhosts in it's config, but also I misread your last post and put that file you told me to create in the conf instead of conf.d directory. It seems to recognize the file, but now all I get is the apache default test page.
 
Old 08-08-2003, 04:59 PM   #10
klintonray
Member
 
Registered: Apr 2003
Location: Phx, AZ
Posts: 61

Original Poster
Rep: Reputation: 15
ok I looked at my error log file again...and it says that /var/www/aba is forbidden by rule....anyone know what this means?
 
Old 08-08-2003, 05:01 PM   #11
haobaba1
Member
 
Registered: Jul 2003
Location: VA Tech
Distribution: Mandrake 9.1
Posts: 73

Rep: Reputation: 15
I have never configured any other version of apache and I know from my reading that the virtual host configurations have changed from previous versions as it was stated in the documentation I read so I am not sure that I can really help you unless you go up to version 2.0.45. try adding your ip address to the named host and specifying the port and see if that works.
 
Old 08-08-2003, 05:06 PM   #12
klintonray
Member
 
Registered: Apr 2003
Location: Phx, AZ
Posts: 61

Original Poster
Rep: Reputation: 15
Ok.....how do I go to version 2.0.45?
 
Old 08-08-2003, 05:08 PM   #13
haobaba1
Member
 
Registered: Jul 2003
Location: VA Tech
Distribution: Mandrake 9.1
Posts: 73

Rep: Reputation: 15
The default is to server web pages out of /var/www/html/ does this directory not exist? I would check the permissions and ownership of the directory and make sure there are no systems files or program files in the directory as you don't want apache to have permission to any folder that has any such files or programs. You should also make sure that the directory is owned by the person administering the site, ie you. Then make sure that you are in the apache group or the nobody group, I think apache is better, and allow group members to modify and read files in that directory. I had a similar problem with permissions when trying to run system calls and modify files and this solved the problem as long as the files were in the correct directory.
 
Old 08-08-2003, 05:13 PM   #14
haobaba1
Member
 
Registered: Jul 2003
Location: VA Tech
Distribution: Mandrake 9.1
Posts: 73

Rep: Reputation: 15
apparently I am outdated already but here is the URL for the new version.

http://www.apache.org/dist/httpd/Announcement2.html
 
Old 08-08-2003, 05:19 PM   #15
klintonray
Member
 
Registered: Apr 2003
Location: Phx, AZ
Posts: 61

Original Poster
Rep: Reputation: 15
yea that directory exists, and if i have no virtual hosts running i can serve pages from it just fine....but i would like to serve pages from different directories so i can run two domains on one server, but i can't seem to do that.
 
  


Reply



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 named virtual host config darthtux Linux - Software 8 04-19-2005 02:38 AM
virtual host ziggie216 Linux - General 2 12-22-2003 06:38 PM
Apache: Virtual Host Config question rajanr Linux - Software 5 08-30-2003 12:41 PM
Major Virtual Host Config Issues klintonray Linux - Software 2 08-07-2003 07:20 PM
VIrtual host thep Linux - General 10 08-06-2002 11:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:00 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
Open Source Consulting | Domain Registration