[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More Questions - the answers are so good!



Hiya,

I can answer the question about hosts.sam file.  Rename the sucker to just
hosts.  That's all there is to it.  ".sam" stands for sample.  Likewise,
you have a lmhosts.sam, which is a sample.  Take off the ".sam" and you
have a file used for SMB.

Now, I'll try to graps and explain what the solution is.  Mr. Zimmerman
suggests adding these lines to your "hosts" file:
127.0.0.1   project1
127.0.0.1   project2
Now, what this does is that whenever you type http://project1 or
http://project2, windows forwards such requests to 127.0.0.1, which is your
localhost.  However, Pi3 allows you to create Virtual Hosts based on
hostname.  So basically you would use  the Pi3 administration tool to
create a Virtual Host by Name for project1 and project2.
However, this only changes the mapping of the "/" to the new directory.
Yet, this time you also want the changing of /cgi-bin/ to the new
directory.  So, what you need to do is find:
<Object>
	Name Start
	Class FlexibleHandlerClass
	Init ReturnCode ReturnCode=COMPLETED
	Headers ReadRequestHeaders
	HostMap VirtualHostByName VirtualHostObject="project1" HostName="project1"

	HostMap ReturnCode ReturnCode=COMPLETED
#	Mapping DirectoryMappings

	#
	# Default mappings
	#
	Mapping MapToErrorDocument \
		IgnoreStatus="0 200" \
		DefaultMessage="/errors/unknown.htm" \
		301="/errors/301.ssi" \
		304="/errors/304.ssi" \
		400="/errors/400.htm" \
		401="/errors/401.ssi" \
		403="/errors/403.ssi" \
		404="/errors/404.ssi" \
		500="/errors/500.ssi" \
		501="/errors/501.htm"
#	Mapping UserDirectory UserDirectoryRoot="/home/" \
#		HTMLDirectory="/public_html"
	Mapping CGIMapper From="/cgi-bin/" To="Cgi-Bin\" 
	Mapping WinCGIMapper From="/cgi-win/" To="Cgi-Win\" 
	Mapping FCGIMapper From="/cgi-fcgi/" To="Cgi-Fcgi\" 
	Mapping PathMapper From="/pidocs/" To="Pi3Docs\" 

	Mapping PathMapper From="/icons/" To="Icons\" 
	Mapping PathMapper From="/images/" To="Images\" 
	Mapping PathMapper From="/errors/" To="Fragment\" 
	Mapping ISAPIMapper From="/isapi/" To="Isapi\" 
	Mapping PathMapper From="/admin/" To="Logs\" \
		Action="&dbreplace(response,string,AuthenticationRealm,Administration)"

	# Document root for the Non-IP virtual host 'project1'
	Mapping Condition="&cmpi($v,project1)" \
		PathMapper From="/" To="c:/project1/"
#
# Default document root
#
	Mapping PathMapper From="/" To="WebRoot\" 
</Object>
in your Config.pi3.  See that nifty line that says: Mapping
Condition="&cmpi($v,project1)" PathMapper From="/" To="c:/project1/".  Well
this line tells Pi3 that if the request is for project1,
then map the "/" to "c:/project1/".  You also want a similiar thing for
your "/cgi-bin/", if you go up a bit, you see the mapping line for cgi-bin:
Mapping CGIMapper From="/cgi-bin/" To="Cgi-Bin\" .  What you do is right
about that line, you insert:
Mapping Condition="&cmpi($v,project1)" CGIMapper From="/cgi-bin/"
To="c:/project1/cgi-bin/".
This tells Pi3 that whenever it is for "project1" and the User Agent wants
something from cgi-bin, don't go to the default CGI-Bin directory, but the
one for project1.

Enjoy.

>Holger, thanks for the reply. The problem I am having is with the above
>instructions - I tried to do this, but I am told that I must dial the
>internet to connect / this site is not available offline. My questions are:
>how do I map to the project specifically? I want project1 to have
>project1/cgi-bin/ I don't have a c:\windows\hosts file, only hosts.sam which
>says it is a sample file, and changing it hasn't done anything.
>To make myself clearer: I want to have http://localhost as the local test
>location for my real site, heagy.com and have atleast one or more
>http://project1, http://project2 which I can use to test my projects. You
>mentioned this was possible. The GUI mapper doesn't ask which host the
>mapping belongs to, so how do I make c:\projects\project1 to map to
>http://project1 and have c:\projects\project1\cgi-bin\ map as CGI for
>http://project1 only?
>
>I really appreciate your help. Thank you very much.
>
>
>Nathan R Heagy
>-- -- --
>Sites Built Better
>http://heagy.com
>