broly Guru


Joined: 21 Feb 2003 Posts: 345 Location: cachan 94
|
Posted: Thu Apr 28, 2005 9:42 am Post subject: [apache2] pb de config vhost |
|
|
Bonjour tt le monde,
j'ai un petit soucis sur la configuration d'apache2.
En faite je cherche a faire du virtual host basé sur 1 seule IP.
J'ai donc acheté un nom de domaine et j'aimerai faire des trucs du genre toto.domain.com ou mrtg.domain.com mais chaque tentative de configuration du vhosts.conf se solde par la meme chose, la page de test d'installation d'apache, pourtant mon navigateur affiche bien http://mrtg.domain.com
J'ai configurer mon dns et tester avec des outils sur le web donc ca a priori il n'y a pas de pbs !!
voici mon fichier de config avec tout les testes (parties commentées) que j'ai effectué :
Code: |
################# Default Named VirtualHosts
#NameVirtualHost 82.224.xx.xxx
#<VirtualHost 82.224.xx.xxx>
# primary vhost
#DocumentRoot /var/www/localhost/htdocs/squirrelmail
#RewriteEngine On
#RewriteRule ^/.* //var/www/localhost/htdocs/index.html
# ...
#</VirtualHost>
################# Named VirtualHosts
#<VirtualHost 82.224.xx.xxx>
#ServerName www.mrtg.domain.com
#ServerPath /mrtg/
#DocumentRoot /var/www/localhost/htdocs/mrtg
#RewriteEngine On
#RewriteRule ^(/mrtg/.*) /var/www/localhost/htdocs$1
#</VirtualHost>
################# Named VirtualHosts
#<VirtualHost 82.224.xx.xxx>
#ServerName www.incoming.domain.com
#ServerPath /incoming/
#DocumentRoot /var/www/localhost/htdocs/incoming
#RewriteEngine On
#RewriteRule ^(/incoming/.*) /var/www/localhost/htdocs$1
#</VirtualHost>
#NameVirtualHost *:80
# <VirtualHost *:80>
# ServerName www.domain.com
# DocumentRoot /var/www/localhost/htdocs/squirrelmail-1.4.4/
# ServerAlias *.yourdomain.net
# catches all mistyped hostnames
# RewriteEngine on
# RewriteCond %{REQUEST_URI} ^domain\.com/webmail$
# RewriteCond %{HTTP_HOST} ^webmail\.domain\.com
# RewriteRule ^/(.*)$ https://webmail.domain.com/$1 [L]
# RewriteCond $1 =webmail
# RewriteRule ^/(.*)$ https://webmail.domain.com/ [R,L]
# RewriteCond %{HTTP_HOST} !^domain.com(:80)?$
# RewriteRule ^/(.*) https://webmail.domain.com/$1 [L,R]
# RewriteOptions inherit
# Redirect /webmail https://webmail.domain.com
# Redirect /mail https://webmail.domain.com
#RewriteCond %{REQUEST_URI} !^/spip.*
#RewriteRule ^(.*)$ /spip/$1 [L]
# </VirtualHost>
### MRTG ###
# <VirtualHost *:80>
# ServerName www.domain.com
# DocumentRoot /var/www/localhost/htdocs/mrtg/
# ServerAlias *.yourdomain.net
# catches all mistyped hostnames
# RewriteEngine on
# RewriteCond %{REQUEST_URI} ^domain\.com/mrtg$
# RewriteRule ^/(.*)$ https://mrtg.domain.com/$1 [L]
# RewriteCond %{HTTP_HOST} ^mrtg\.domain\.com$
# RewriteRule ^/(.*)$ https://mrtg.domain.com/$1 [R,L]
# RewriteCond $1 =mrtg
# RewriteRule ^/(.*)$ https://mrtg.domain.com/ [R,L]
# RewriteCond %{HTTP_HOST} !^domain.com(:80)?$
# RewriteRule ^/(.*) http://mrtg.domain.com/$1 [L,R]
# RewriteOptions inherit
# Redirect /mrtg https://mrtg.domain.com
# </VirtualHost>
#++++ TEST Multiple VIRTUAL HOSTING ++++#
# enable the rewriting engine in the main server
###RewriteEngine on
# define two maps: one for fixing the URL and one which defines
# the available virtual hosts with their corresponding
# DocumentRoot.
###RewriteMap lowercase int:tolower
###RewriteMap vhost txt:/etc/apache2/conf/vhosts/vhost.map
# Now do the actual virtual host mapping
# via a huge and complicated single rule:
#
# 1. make sure we don't map for common locations
###RewriteCond %{REQUEST_URI} !^webmail\.domain\.com/.*
###RewriteCond %{REQUEST_URI} !^mrtg\.domain\.com/.*
#RewriteCond %{REQUEST_URI} !^/commonurlN/.*
#
# 2. make sure we have a Host header, because
# currently our approach only supports
# virtual hosting through this header
###RewriteCond %{HTTP_HOST} !^$
#
# 3. lowercase the hostname
###RewriteCond ${lowercase:%{HTTP_HOST}|NONE} ^(.+)$
#
# 4. lookup this hostname in vhost.map and
# remember it only when it is a path
# (and not "NONE" from above)
###RewriteCond ${vhost:%1} ^(/.*)$
#
# 5. finally we can map the URL to its docroot location
# and remember the virtual host for logging puposes
###RewriteRule ^/(.*)$ %1/$1 [E=VHOST:${lowercase:%{HTTP_HOST}}]
#++++ FIN TEST Multiple VIRTUAL HOSTING ++++#
ServerName localhost
NameVirtualHost *
#
# Match a webpage directory with each website
#
<VirtualHost *>
DocumentRoot /var/www/localhost/htdocs
</VirtualHost>
<VirtualHost 82.224.xx.xxx>
DocumentRoot /var/www/localhost/htdocs/mrtg
ServerName mrtg.domain.com
ErrorLog /var/log/apache2/mrtg.domain.com-error.log
CustomLog /var/log/apache2/mrtg.domain.com-common.log common
Setenv VLOG /var/log/apache2/
RewriteEngine On
RewriteOptions inherit
</VirtualHost>
<VirtualHost 82.224.xx.xxx>
DocumentRoot /var/www/localhost/htdocs/squirrelmail-1.4.4
ServerName webmail.domain.com
ErrorLog /var/log/apache2/webmail.domain.com-error.log
CustomLog /var/log/apache2/webmail.domain.com-common.log "combined"
Setenv VLOG /var/log/apache2/
RewriteEngine On
RewriteOptions inherit
LogLevel debug
</VirtualHost>
#
# Make sure the directories specified above
# have restricted access to read-only.
#
<Directory "/var/www/localhost/htdocs/*">
Order allow,deny
Allow from all
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
|
|
|