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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

virtual host/documentRoot

Status
Not open for further replies.

conntaxman

Programmer
Aug 7, 2003
55
0
0
US
VirtualHost / DirectRoot /paths...I cant seem to understand the paths as good as i should.would like some help.
I have apahce 2.0 running and have my index page showing up on the web.But now I want to put ALL my html files on my own server.I use DYN to keep my IP the same.router set up correct.
my copy of V.H.
###################

# 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>
<VirtualHost *:192.168.1.20>
ServerAdmin conntaxman@yahoo.com
DocumentRoot /Apache
Group/Apache2/htdocs/homerepairs/site/webpages
# DocumentRoot /Apache Group/Apache2/htdocs/homerepairs/site/webpages
ServerName homerepairs.is-a-geek.net
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log
commom
#</VirtualHost>
##################################################
The <VirtualHost *:192.168.1.20> ip number is what I put
in for my server Behind the router.
I made my folders in
-htdocs
-homerepairs
-site
webpages [html files are here]
thank you very much for the help
Been going nuts and getting frustrated.sure would like some help.
Thank you very much.
Johnny
conntaxman@yahoo.com



When I put a link and try to get info from my "webpages" folder,it will just come back Page cannot be displayed.
 
Hi

If the value contain space character, surround it with double quotes ( " ).
Code:
 DocumentRoot [red]"[/red]/Apache Group/Apache2/htdocs/homerepairs/site/webpages[red]"[/red]

Feherke.
 
The VirtualHost directive is not correct. You should have one or the other of:

<VirtualHost *:80>
Which listens on every IP address available

or

<VirtualHost 192.168.1.20:80>
Which only listens on that specific address
 
I replied once but dont see it.
I put in the "" and I took away the IP adderss.\
Could you tell me if I have this right.
##############
<Directory"C:/Program Files/Apache Group/Apache2/htdocs/homerepairs/">
##############
Thank all ,for all the help.Sure dose mean alot.
Johnny
guess Ill go make my link and see it I could get info
from my Folder .homerepairs.
see you later.Ill let you all know.
 
I tried all these different links and nothing is working,
any idea's ?
###########
C:\Program Files\Apache Group\Apache2\htdocs\homerepairs\site\webpages\Test page for Vhost.html
.
.
Files/Apache Group/Apache2/htdocs/homerepairs/site/webpages/Test page for Vhost.html
.
.
Group/Apache2/htdocs/homerepairs/site/webpages/Test page for Vhost.html
.
.
Files/Apache Group/Apache2/htdocs/homerepairs/site/webpages/Test page for Vhost.html
.
.
Group/Apache2/htdocs/homerepairs/site/webpages/Test page for Vhost.html
.
.
Forbidden
You don't have permission to access /C:/Program Files/Apache Group/Apache2/htdocs/homerepairs/site/webpages/Test page for Vhost.html on this server.


--------------------------------------------------------------------------------

Apache/2.0.59 (Win32) Server at Port 80
#########################
any help would be great.
Thanks
Johnny
 
Remember that your DocumentRoot is so all you subdirectories are relative to it. So if a sub-directory called ceiling is in your DocumentRoot, the url would be You do not need the name of the index page if it is one of your listed DirectoryIndex names.
 
Hold on, we seem to be jumping all over the place all of a sudden. First, after making the apache changed that feherke & I have made, did apache work correctly?

Next, what is:
##############
<Directory"C:/Program Files/Apache Group/Apache2/htdocs/homerepairs/">
##############

all about? This hasn't been previously mentioned at all, but any Directory container will need opening & closing tags. And, I suspect that the missing space will also cause problems. So, a Directory ciontainder for this directory should look like:
##############
<Directory "C:/Program Files/Apache Group/Apache2/htdocs/homerepairs/">
</Directory>
##############

This would be a good time to review the documentation

Finally, the link on the 'Ceiling's page is not a correctly formatted URL
 
Also, I meant to add that that Directory container by itself is rather useless anyway without some directives inside it.
 
Sorry for putting the cart before the horse smah, but I thought he said he got that all working but was having problems with his "links".
 
Actually RA, your post wasn't even there when I started writing that, but your post is correct also. I'm beginning to think that there might be some more information needed about how this is set up.
 
smah :when I removed the two lines[the ip and other
it apache did work,I could go to the net and type in
my homerepairsdoneforless.com and it worked bringing
up the index page that I had put in htdocs.Im now just
tring to type in the browser just to get a file in
my folder that i made.[webpages]and when that page
shows up in the browser it is this address,and that
is what i used for the link.
C:\Program Files\Apache Group\Apache2\htdocs\homerepairs\site\webpages\Test page for Vhost.html
My Sh-tty luck it wont work.
And I read about everything on the net pertaining to
V.H. and there are many that show ways.
Im sorry to bother,but im determinded to get this to
work.
Ha atleast i have my Index.page to work.
Thanks for the help. [sorry]
Johnny
should i just paste the whole script here?or send it
to the monerator? ha ha
 
For setting up virtual hosts, see
How to set up Name Based Vitualhosts on Apache. faq65-1831

Remember that once VirtualHosts are set up, the default server no longer serves any pages. You'll need to have a virtualhost for whatever is currently the default server (ServerName, ServerAlias, DocumentRoot, etc).

 
Conntaxman, you are confusing url/uri with path. The path is the physical location on your hard drive. Your browser understands both. If it is a url then it will use http:// in front of the address. If it is a path to a file on your local computer, then it is preceded with file://. Since you are using apache to serve the page you are looking for, http protocol is assumed. This means that everything starts with the domain name. For Example if I type I go to that domain's DocumentRoot. Now if I wanted a different page from index.html but it is still in the DocumentRoot, I would type If it is in a sub-directory of the DocumentRoot called subdir then the url would be
 
RhythmAce ;thank you,I can call up an image out of the
htdocs by useing But when i try to pull up a html page now atleats i
get FORBIDDEN you dont have permission to access
/c:/program files/apache group/apache2/htdocs/test_page
.html
this is what im putting in
files/apache group
/apache2/htdocs/homerepairs/site/webpages/
Ill just have to get a Permission slip from someone.
lol.
oops. just stuck an image in one folder that I made
[webpages] and got the same,FORBIDDEN you don't>>>>>
could my folders need a higher permission?
never gave them any permission.
tks alot.
Johnny
 
Whenever you create a directory container you are telling apache who can do what in that directory. When you use a directive in a directory container, those directives apply to that directory and all its sub-directories. So if you want everybody to be able to browse to a directory, it should have at least the following lines:

Order allow, deny
Allow from all



 
I can get "images" out of my folder that I made in htdocs
but I cant get any html pages out of the same folder.
It comes up forbidden no permission.No matter what
I put in the address bar.
###################

DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/homerepairs"
#
once i did get INDEX PAGE
showing the files.
.
Help im going nuts.
also i looked on the net and read more and more.
changed and rechanged and back to the same.
Sorry.
But thanks, I need help !!!! lol
 
Ill paste this here so U can look.tks
# added line below jrb 1-24-07
<Files ~ "^\.ht">
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS PROPFIND>
Order allow,deny
#Allow from all
#</Limit>
#<LimitExcept GET POST OPTIONS PROPFIND>
#Order deny,allow
Deny from all
#</LimitExcept>
</Files>
# added ling above [</files> 1-24-07 jrb
#</Directory>
----------------------------------------------------
# added line below 1-24-07 jrb
Include conf/virtual-hosts.conf
#
#
# 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 conntaxman@yahoo.com
DocumentRoot "/Apache Group/Apache2/htdocs/homerepairs"
# DocumentRoot /Apache Group/Apache2/htdocs/homerepairs/site/webpages
ServerName homerepairs.is-a-geek.net
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>
.........................
Tks.
Johnny
 
Another thing is when I go to the folder in apache
ON MY SERVER and
double click on the html page it will come up as
C:\Program Files\Apache Group\Apache2\htdocs\homerepairs\test_page.htm
.......................
But when I put
test_page.htm
it comes up forbidden.
or any other way i type it in.
Thanks
Johnny
the part that gets me is that I can get an image
to come up.
 
As RythmAce mentioned, the URL in your browser that's used to accesses the document is relative to the apache server DocumentRoot - it will not be the same as the local computer path to that same document.

So if your ServerName is:
homerepairs.is-a-geek.net
And the path to the DocumentRoot is:
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/homerepairs"

and that folder contains a file named test_page.html

Using your browser, you'd use the URL:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top