You are not logged in.

#1 2005-01-30 06:18:20

ruwach
Member
Registered: 2004-06-14
Posts: 143

please help with virtual hosting

hey there, i have checked the forums and all the docs at apache, but i cant find out what i am doing wrong.

i want to host two domains from this one computer with only one connection to the internet.
they are registered at Godaddy and i am using zoneedit to do the dns thing. so they are all comming to one ip.

so here is what i have in httpd.conf

listen 80

NameVirtualHost *:80

</VirtualHost *:80>
ServerName www.site1.org
DoccumentRoot /home/httpd/html/site1
</VirtualHost>

</VirtualHost *:80>
ServerName www.site2.com
DoccumentRoot /home/httpd/html/site2
</VirtualHost>

in the /home/httpd/html/ dirrectory i have two folders site1 and site2 with the index files in each.

i can open a browser and go to www.site1.org and loads up nice,
but when i try to go to site2, it tells me the server refused the connection.

any ideas ?
thanks

Offline

#2 2005-01-30 06:39:28

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,615
Website

Re: please help with virtual hosting

NameVirtualHost *:80
<VirtualHost *:80>
ServerName site1.org
ServerAlias *.site1.org
DoccumentRoot /home/httpd/html/site1
  <Directory "/home/httpd/html/site1">
      Options -Indexes +FollowSymLinks
      AllowOverride Options Indexes AuthConfig
      Order allow,deny
      Allow from all
  </Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName site2.com
ServerAlias *.site2.com
DoccumentRoot /home/httpd/html/site2
  <Directory "/home/httpd/html/site2">
      Options -Indexes +FollowSymLinks
      AllowOverride Options Indexes AuthConfig
      Order allow,deny
      Allow from all
  </Directory>
</VirtualHost> 

The above is similar to a few things I have. I use the same setup. Name based virtual hosting with apache, zoneedit for dns.
the key you were missing was that virtualhost does not begin with a /. It is like an XML tag. Only / on the closing tag.
You were also missing the specific directory sections.
Be sure to restart apache after making changes to /etc/httpd/conf/httpd.conf
Good luck.

ps. Check /var/log/httpd/error_log  when things aren't working right. Often it will show up in there.


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#3 2005-01-30 16:25:53

ruwach
Member
Registered: 2004-06-14
Posts: 143

Re: please help with virtual hosting

still having a problem with it.
i commented out with # all entries regarding virtual hosting.
i then moved the index file from
/home/httpd/html/site2 and put it into
/home/httpd/html

opened firefox and went to www.site2.com and there it was !

so i have something awry in me ol http.conf regarding virtual hosting.

here is what i have in http.conf right now

#
<IfModule !mpm_winnt.c>
<IfModule !mpm_netware.c>
#LockFile /var/log/httpd/accept.lock
</IfModule>
</IfModule>

<IfModule !mpm_netware.c>
<IfModule !perchild.c>
#ScoreBoardFile /var/log/httpd/apache_runtime_status
</IfModule>
</IfModule>

<IfModule !mpm_netware.c>
PidFile /var/run/httpd.pid
</IfModule>

Timeout 300

KeepAlive On

MaxKeepAliveRequests 100

KeepAliveTimeout 15

<IfModule prefork.c>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
</IfModule>

<IfModule worker.c>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>

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

<IfModule mpm_winnt.c>
ThreadsPerChild 250
MaxRequestsPerChild 0
</IfModule>

<IfModule beos.c>
StartThreads 10
MaxClients 50
MaxRequestsPerThread 10000
</IfModule>

<IfModule mpm_netware.c>
ThreadStackSize 65536
StartThreads 250
MinSpareThreads 25
MaxSpareThreads 250
MaxThreads 1000
MaxRequestsPerChild 0
</IfModule>

<IfModule mpmt_os2.c>
StartServers 2
MinSpareThreads 5
MaxSpareThreads 10
MaxRequestsPerChild 0
</IfModule>

Listen 80

LoadModule access_module lib/apache/mod_access.so
LoadModule actions_module lib/apache/mod_actions.so
LoadModule alias_module lib/apache/mod_alias.so
LoadModule asis_module lib/apache/mod_asis.so
LoadModule auth_module lib/apache/mod_auth.so
LoadModule auth_anon_module lib/apache/mod_auth_anon.so
LoadModule auth_dbm_module lib/apache/mod_auth_dbm.so
LoadModule auth_digest_module lib/apache/mod_auth_digest.so
LoadModule autoindex_module lib/apache/mod_autoindex.so
LoadModule cgi_module lib/apache/mod_cgi.so
LoadModule dav_module lib/apache/mod_dav.so
LoadModule dav_fs_module lib/apache/mod_dav_fs.so
LoadModule dir_module lib/apache/mod_dir.so
LoadModule env_module lib/apache/mod_env.so
LoadModule expires_module lib/apache/mod_expires.so
LoadModule ext_filter_module lib/apache/mod_ext_filter.so
LoadModule headers_module lib/apache/mod_headers.so
LoadModule imap_module lib/apache/mod_imap.so
LoadModule include_module lib/apache/mod_include.so
LoadModule info_module lib/apache/mod_info.so
LoadModule log_config_module lib/apache/mod_log_config.so
LoadModule mime_module lib/apache/mod_mime.so
LoadModule negotiation_module lib/apache/mod_negotiation.so
LoadModule rewrite_module lib/apache/mod_rewrite.so
LoadModule setenvif_module lib/apache/mod_setenvif.so
LoadModule speling_module lib/apache/mod_speling.so
LoadModule ssl_module lib/apache/mod_ssl.so
LoadModule status_module lib/apache/mod_status.so
LoadModule userdir_module lib/apache/mod_userdir.so
LoadModule vhost_alias_module lib/apache/mod_vhost_alias.so
#LoadModule php5_module lib/apache/libphp5.so

<IfModule !mpm_winnt.c>
<IfModule !mpm_netware.c>
User nobody
Group #-1
</IfModule>
</IfModule>

ServerAdmin me@isp.net

UseCanonicalName Off

DocumentRoot "/home/httpd/html"

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

<Directory "/home/httpd/html">

Options Indexes FollowSymLinks

AllowOverride None

Order allow,deny
Allow from all

</Directory>

UserDir public_html

<IfModule mod_php5.c>
DirectoryIndex index.php index.html
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
</IfModule>

DirectoryIndex index.html index.html.var

AccessFileName .htaccess

<Files ~ "^.ht">
Order allow,deny
Deny from all
</Files>

TypesConfig /etc/httpd/conf/mime.types

DefaultType text/plain

<IfModule mod_mime_magic.c>
MIMEMagicFile /etc/httpd/conf/magic
</IfModule>

HostnameLookups Off

http://httpd.apache.org/docs-2.0/mo...html#enablemmap

ErrorLog /var/log/httpd/error_log

LogLevel warn

LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined
LogFormat "%h %l %u %t "%r" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
"%{Referer}i" "%{User-Agent}i" %I %O" combinedio

ServerTokens Prod

ServerSignature On

Alias /icons/ "/home/httpd/icons/"

<Directory "/home/httpd/icons">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

ScriptAlias /cgi-bin/ "/home/httpd/cgi-bin/"

<IfModule mod_cgid.c>
</IfModule>

<Directory "/home/httpd/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

IndexOptions FancyIndexing VersionSort

AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

DefaultIcon /icons/unknown.gif

ReadmeName README.html
HeaderName HEADER.html

IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t

ForceLanguagePriority Prefer Fallback

AddType application/x-tar .tgz
AddType image/x-icon .ico

BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4.0" force-response-1.0
BrowserMatch "Java/1.0" force-response-1.0
BrowserMatch "JDK/1.0" force-response-1.0

BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully
BrowserMatch "^gnome-vfs" redirect-carefully

<IfModule mod_ssl.c>
Include /etc/httpd/conf/ssl.conf
</IfModule>

### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs-2.0/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
#NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog /var/log/httpd/dummy-host.example.com-error_log
# CustomLog /var/log/httpd/dummy-host.example.com-access_log common

#<VirtualHost *:80>
#ServerName www.site2.com
#ServerAlias *.site2.com
#DoccumentRoot /home/httpd/html/site2
# <Directory "/home/httpd/html/site2">
# Options - Indexes +FollowSymLinks
# AllowOverride Options Indexes AuthConfig
# Order allow,deny
# Allow from all
# </Directory>
#</VirtualHost>

#<VirtualHost *:80>
#ServerName www.site1.org
#ServerAlias *.site1.org
#DoccumentRoot /home/httpd/html/site1
# <Directory "/home/httpd/html/site1">
# Options - Indexes +FollowSymLinks
# AllowOverride Options Indexes AuthConfig
# Order allow,deny
# Allow from all

# </Directory>
#</VirtualHost>


except for some stuff about languages and icons, didnt feel like that part mattered for this.

please advise
and thanks

Offline

#4 2005-01-30 19:54:02

ruwach
Member
Registered: 2004-06-14
Posts: 143

Re: please help with virtual hosting

Hey its fixed.
i had a <virtualHost> opened without a closeing statement.

thanks for your good advice !

Offline

Board footer

Powered by FluxBB