|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Virtuelhosts
I have a standard httpd.conf file and what to use virtuelhosts (NameBased as I have two Names pointing to the same IP.)
Problem is that my documentroot don't work. It doesn't override the old docroot. What can be wrong? NameVirtualHost 212.212.12.121 <VirtualHost 212.212.12.121> DocumentRoot d:/program files/apache group/apache/htdocs/contra ServerName myserver.com CustomLog logs/myserver.com-access_log #</VirtualHost> Thx for your time.
__________________
\Oliver For those about to php - we salute you! |
|
#2
|
|||
|
|||
|
1) I know nothing about Apache in win32 environment
2) d:/program files/apache group/apache/htdocs/contra, is this path under your default path or default docroot? If not, you also need a <Directory> block for this 3) What error? What didn't work exactly? |
|
#3
|
|||
|
|||
|
My default documentroot is d:/program files/apache group/apache/htdocs
I don't get any error. It just don't overwrite the default documentroot. I've tried to copy the directory settings for default documentroot (which works). I't doesn't help a bit. The configuration of Apache on win32 is almost the same as on a *nix box. |
|
#4
|
|||
|
|||
|
Are you sure DocumentRoot d:/program files/apache group/apache/htdocs/contra could be unquoted?
In UNIX, you almost always have to quote the path if it has whitespace in the string or path ("d:/program files/apache group/apache/htdocs/contra") |
|
#5
|
|||
|
|||
|
I've tried that.. Here is my conf file
ServerType standalone
ServerRoot "D:/Program Files/Apache Group/Apache" PidFile logs/httpd.pid ScoreBoardFile logs/apache_runtime_status #ResourceConfig conf/srm.conf #AccessConfig conf/access.conf # # Timeout: The number of seconds before receives and sends time out. # Timeout 300 KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 15 MaxRequestsPerChild 0 ThreadsPerChild 50 #Listen 3000 #Listen 12.34.56.78:80 #BindAddress * # #ClearModuleList #AddModule mod_so.c mod_mime.c mod_access.c mod_auth.c mod_negotiation.c #AddModule mod_include.c mod_autoindex.c mod_dir.c mod_cgi.c mod_userdir.c #AddModule mod_alias.c mod_env.c mod_log_config.c mod_asis.c mod_imap.c #AddModule mod_actions.c mod_setenvif.c mod_isapi.c # # Dynamic Shared Object (DSO) Support # #LoadModule anon_auth_module modules/mod_auth_anon.so #LoadModule dbm_auth_module modules/mod_auth_dbm.so #LoadModule digest_auth_module modules/mod_auth_digest.so #LoadModule cern_meta_module modules/mod_cern_meta.so #LoadModule digest_module modules/mod_digest.so #LoadModule expires_module modules/mod_expires.so #LoadModule headers_module modules/mod_headers.so #LoadModule proxy_module modules/mod_proxy.so #LoadModule rewrite_module modules/mod_rewrite.so #LoadModule speling_module modules/mod_speling.so #LoadModule info_module modules/mod_info.so #LoadModule status_module modules/mod_status.so #LoadModule usertrack_module modules/mod_usertrack.so #ExtendedStatus On Port 80 ServerAdmin olila@worldonline.dk ServerName localhost DocumentRoot "D:/Program Files/Apache Group/Apache/htdocs" <Directory /> Options FollowSymLinks AllowOverride None </Directory> # # This should be changed to whatever you set DocumentRoot to. # <Directory "D:/Program Files/Apache Group/Apache/htdocs"> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny Allow from all </Directory> <IfModule mod_dir.c> DirectoryIndex index.html </IfModule> AccessFileName .htaccess <Files ~ "^\.ht"> Order allow,deny Deny from all </Files> #CacheNegotiatedDocs UseCanonicalName On <IfModule mod_mime.c> TypesConfig conf/mime.types </IfModule> DefaultType text/plain <IfModule mod_mime_magic.c> MIMEMagicFile conf/magic </IfModule> HostnameLookups Off ErrorLog logs/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 CustomLog logs/access.log common ServerSignature On <IfModule mod_alias.c> Alias /icons/ "D:/Program Files/Apache Group/Apache/icons/" <Directory "D:/Program Files/Apache Group/Apache/icons"> Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all </Directory> ScriptAlias /cgi-bin/ "D:/Program Files/Apache Group/Apache/cgi-bin/" <Directory "D:/Program Files/Apache Group/Apache/cgi-bin"> AllowOverride None Options None Order allow,deny Allow from all </Directory> </IfModule> # End of aliases. fModule mod_autoindex.c> IndexOptions FancyIndexing AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip AddIconByType (TXT,/icons/text.gif) text/* AddIconByType (IMG,/icons/image2.gif) image/* AddIconByType (SND,/icons/sound2.gif) audio/* AddIconByType (VID,/icons/movie.gif) video/* AddIcon /icons/binary.gif .bin .exe AddIcon /icons/binhex.gif .hqx AddIcon /icons/tar.gif .tar AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip AddIcon /icons/a.gif .ps .ai .eps AddIcon /icons/layout.gif .html .shtml .htm .pdf AddIcon /icons/text.gif .txt AddIcon /icons/c.gif .c AddIcon /icons/p.gif .pl .py AddIcon /icons/f.gif .for AddIcon /icons/dvi.gif .dvi AddIcon /icons/uuencoded.gif .uu AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl AddIcon /icons/tex.gif .tex AddIcon /icons/bomb.gif core AddIcon /icons/back.gif .. AddIcon /icons/hand.right.gif README AddIcon /icons/folder.gif ^^DIRECTORY^^ AddIcon /icons/blank.gif ^^BLANKICON^^ DefaultIcon /icons/unknown.gif ReadmeName README HeaderName HEADER # # IndexIgnore is a set of filenames which directory indexing should ignore # and not include in the listing. Shell-style wildcarding is permitted. # IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t </IfModule> # End of indexing directives. # # Document types. # <IfModule mod_mime.c> AddEncoding x-compress Z AddEncoding x-gzip gz tgz AddLanguage da .dk AddLanguage nl .nl AddLanguage en .en AddLanguage et .ee AddLanguage fr .fr AddLanguage de .de AddLanguage el .el AddLanguage he .he AddCharset ISO-8859-8 .iso8859-8 AddLanguage it .it AddLanguage ja .ja AddCharset ISO-2022-JP .jis AddLanguage kr .kr AddCharset ISO-2022-KR .iso-kr AddLanguage no .no AddLanguage pl .po AddCharset ISO-8859-2 .iso-pl AddLanguage pt .pt AddLanguage pt-br .pt-br AddLanguage ltz .lu AddLanguage ca .ca AddLanguage es .es AddLanguage sv .se AddLanguage cz .cz AddLanguage ru .ru AddLanguage tw .tw AddLanguage zh-tw .tw AddCharset Big5 .Big5 .big5 AddCharset WINDOWS-1251 .cp-1251 AddCharset CP866 .cp866 AddCharset ISO-8859-5 .iso-ru AddCharset KOI8-R .koi8-r AddCharset UCS-2 .ucs2 AddCharset UCS-4 .ucs4 AddCharset UTF-8 .utf8 <IfModule mod_negotiation.c> LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br ru ltz ca es sv tw </IfModule> LoadModule php4_module d:/php/sapi/php4apache.dll AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps AddType application/x-tar .tgz #AddHandler imap-file map #AddHandler type-map var </IfModule> # End of document types. #MetaDir .web #MetaSuffix .meta <IfModule mod_setenvif.c> 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 </IfModule> # End of browser customization directives ### 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://www.apache.org/docs/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 213.237.25.182 # # 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 213.237.25.182> DocumentRoot "D:/Program Files/Apache Group/Apache/htdocs/contra" ServerName contradanmark.dk </VirtualHost> <Directory "D:/Program Files/Apache Group/Apache/htdocs/contra"> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny Allow from all </Directory> Last edited by olila : July 21st, 2001 at 08:17 AM. |
|
#6
|
|||
|
|||
|
Next time you post your httpd.conf, don't post the lines that have been commented out (the ones begin with #).
You said It doesn't override the old docroot. What you mean by old? The default D:/Program Files/Apache Group/Apache/htdocs? >> NameBased as I have two Names pointing to the same IP If you have two, configure two <VirtualHost> blocks (yes, your default server, too). Suppose you have worldonline.dk as your default server and contradanmark.dk as a vhost: 1) Uncomment this line -> ServerName localhost 2) Change to Off -> UseCanonicalName On 3) Finally, add/change to: NameVirtualHost 213.237.25.182 <VirtualHost 213.237.25.182> DocumentRoot "D:/Program Files/Apache Group/Apache/htdocs" ServerName worldonline.dk </VirtualHost> <VirtualHost 213.237.25.182> DocumentRoot "D:/Program Files/Apache Group/Apache/htdocs/contra" ServerName contradanmark.dk </VirtualHost> |
|
#7
|
|||
|
|||
|
Error message
After doing the motifications you suggested I got:
Could not determine the server's fully qualified domain name uses 192.168.1.2 >>You said It doesn't override the old docroot. What you mean by old? The default D:/Program Files/Apache Group/Apache/htdocs? Yes, that is what I mean. I'm grateful for your help |
|
#8
|
|||
|
|||
|
>> Could not determine the server's fully qualified domain name uses 192.168.1.2
Put the following to C:\Windows\hosts file (create this manually if you have to) 192.168.1.2 defaultname worldonline.dk contradanmark.dk And change the following: 1) Uncomment ServerName globally and set it to: defaultname 2) Change to: NameVirtualHost 192.168.1.2 3) Change to: <VirtualHost192.168.1.2> 4) Pinging 192.168.1.2 locally should return defaultname 5) Ping worldonline.dk (despite it's a real domain resolves to another IP) should return 192.168.1.2 Since you are testing this locally, you can simply append any domain name you want to that line in hosts file. |
|
#9
|
|||
|
|||
|
Let me put it short:
It works
![]() Thank you very much for your time and help. God Speed.. |
|
#10
|
|||
|
|||
|
I was to fast
It don't work
NameVirtualHost 192.168.1.2 <VirtualHost 192.168.1.2> DocumentRoot "D:/Program Files/Apache Group/Apache/htdocs/tekk" ServerName tekk.dk </VirtualHost> <Directory "D:/Program Files/Apache Group/Apache/htdocs/tekk"> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny Allow from all </Directory> <VirtualHost 192.168.1.2> DocumentRoot "D:/Program Files/Apache Group/Apache/htdocs/contra" ServerName contradanmark.dk </VirtualHost> <Directory "D:/Program Files/Apache Group/Apache/htdocs/contra"> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny Allow from all </Directory> It takes the first virtualhost's docroot and uses that as also the next virtualhost. In my host file I have 192.168.1.2 contradanmark.dk tekk.dk |
|
#11
|
|||
|
|||
|
1) Put the <Directory> block within <VirtualHost> or define <Directory> sooner by moving its position in httpd.conf higher.
2) Your global docroot (not within <VirtualHost> should now be DocumentRoot "D:/Program Files/Apache Group/Apache/htdocs/tekk". 3) Make sure UseCanonicalName is off |
|
#12
|
|||
|
|||
|
Same problem
That doesn't help
![]() I did restart the Apache-server. I have, as you told me to, set UseCanonicalName off |
|
#13
|
|||
|
|||
|
If you want tekk.dk to be default:
1) Uncomment ServerName line from global 2) Alter your hosts file and change the order to: 192.168.1.2 tekk.dk contradanmark.dk 3) If ping returns tekk.dk, then that's the default ServerName and its <VirtualHost> block should go first. |
|
#14
|
|||
|
|||
|
Maybe I misunderstood virtuel hosts
When user enter www.tekk.dk, I want the server to load files from /tekk. When the user enter www.contradanmark.dk, I want the server to load files from /contra. Is that not what virtuelhosts is also about? Is that what we are trying to do?
|
|
#15
|
|||
|
|||
|
Shouldn't ServerName be set to the ip-adr. for the two domains?
|
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > Virtuelhosts |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |