Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Namevirtualhosts, virtual hosts, nice looking url

Status
Not open for further replies.

frie

IS-IT--Management
Dec 22, 2002
3
NL
I have a complex problem wich is ass foolows
I tried to creat nice looking Url fore subdomains
anamen.domain.com instead off domain.com/~aname I tried to use the mod_rewrite in the httpd.conf but i keep falling in the wrong domain mainpage.in the httpd.conf is a <virtualhost>Include /etc/httpd/conf/vhosts/site1 and this fore the 4 sites that are on the server (site2, site3 eso)
when I restart httpd i get &quot; NameVirtualHost 32.512.86.78:80 has no VirtualHosts &quot; fore 3 sites
what is wrong in this and do I do the rewrite in virtual host on in the hhtpd.conf

I run a raq 550 i posted with sun
supportforum.sun.com/cgi-bin/WebX.cgi?13@55.MXS6agTfj4K^0@.eeb2a92
any one has a idea
T.I.A.
 
Here is a sample vhost container. You will be using name based addressing so you don't need the ip and port. The &quot;*&quot; tells apache to listen for all addresses on all ports. Inside the vhost container, you MUST have a ServerName defined. If you use virtual hosting, you must also have you main ( in a vhost container also. You may also need to put &quot;UseCanonicalName Off&quot; in each container. I run RH 8.0 and only need it in the globals. Almost any directive that can be in the MAIN (global) section, can be used it the vhost container and it's directory containers.

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

#
# 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 *>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>
 
sorry RhythmAce

it all stays just the same no change
I gave them all the &quot;*&quot; but it did no make any difference
 
Can you post a section of your httpd.conf here? I just need the part with your vhost containers. Another thing to check is in the main configs where it says ServerName. That should be localhost or something but not your domain name. Listen should be set to your ip. This is in the main section not in your vhost containers.
 
Hi RhythmAce
at the end off the httpd.conf are these lines
>>
Include /etc/httpd/conf/vhosts/site4
Include /etc/httpd/conf/vhosts/site3
Include /etc/httpd/conf/vhosts/site5
>>
in the site are the followwing line

>>

# owned by VirtualHost
NameVirtualHost 92.222.86.78

# frontpage needs the following four things to be here
# otherwise all the vhosts need to go in httpd.conf, which could
# get very large since there could be thousands of vhosts
Port 80
ServerRoot /etc/httpd
ResourceConfig /etc/httpd/conf/srm.conf
AccessConfig /etc/httpd/conf/access.conf

<VirtualHost 92.222.86.78>
ServerName ServerAdmin admin
DocumentRoot /home/.sites/28/site1/web
ErrorDocument 401 /error/401-authorization.html
ErrorDocument 403 /error/403-forbidden.html
ErrorDocument 404 /error/404-file-not-found.html
ErrorDocument 500 /error/500-internal-server-error.html
RewriteEngine on
RewriteCond %{HTTP_HOST} !^92.222.86.78:)80)?$
RewriteCond %{HTTP_HOST} !^ [NC]
RewriteMap lowercase int:tolower
RewriteCond ${lowercase:%{HTTP_HOST}} !^$
RewriteCond ${lowercase:%{HTTP_HOST}} !^RewriteCond ${lowercase:%{HTTP_HOST}} ^(www\.|)([^.]+)\.domain\.com$
RewriteRule ^(.+) ${lowercase:%{HTTP_HOST}}$1 [C]
RewriteRule ^(www\.|)([^.]+)\.domain\.com(.*) /users/$2$3 [L]
RewriteCond ${lowercase:%{HTTP_HOST}} ^(www\.|)[^.]+\.[^.]+\.domain\.com$
RewriteRule ^(.+) ${lowercase:%{HTTP_HOST}}$1 [C]
RewriteRule ^(www\.|)([^.]+)\.([^.]+)\.domain\.com(.*) /users/$3/$2$4 [L]
RewriteOptions inherit
AliasMatch ^/~([^/]+)(/(.*))? /home/.sites/143/site2/users/$1/web/$3
# BEGIN WebScripting SECTION. DO NOT EDIT MARKS OR IN BETWEEN.
# END WebScripting SECTION. DO NOT EDIT MARKS OR IN BETWEEN.
</VirtualHost>
# end of VirtualHost owned section

>>


Whem i do a reastart off httpd its says
>>

NameVirtualHost has no virtualhost

>>
this is only given from the 2e 3rd and so on

the first one site1 gives a nice url but the same kind off rewrite on site2 or site3 always brings me back to home page site1, but the browers adress will say aname.site2.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top