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

VirtualHost/more folders 3

Status
Not open for further replies.

conntaxman

Programmer
Aug 7, 2003
55
US
question is ,after setting up VirtualHost for one additional folder in htdocs, now to put more subfolders
will i have to set up more VirtualHost? one for each
additional folder.
Because i couldn't get to my subfolder in the folder that
i made.
tks
johnny
Its late and that is why im asking,otherwise i would just
try it.
 
Yup that's it.I just tried and it works,guess a V.H
for every new folder.
Johnny
 
Are these additional directories subdirectories of the document root of the original virtual host? If so, you don't need VirtualHost directives for each subdirectory.


Want the best answers? Ask the best questions! TANSTAAFL!
 
I agree. You only need VirtuaHost's if you have multiple virtual hosts. For additional directories within a server/host, you might need Alias directives, Directory container directives, or possibly symolic links within the filesystem, depending on how your system is configured & what you're trying to do. You shouldn't need VirtualHost's for every directory. The apache documentation may be some help to clarify how this works
 
Well TKS. again.
Ill look in the doc's about more folders.But it dose work that way.
I know that you guys know.
Great bunch of guys.
Johnny
 
Been looking on the net and at apache ,to read about just
adding sub-folders and Im finding everything else.
it must be some small peice of code.
Ill keep a looking.
But if anyone knows,could you throw it my way.
tks
Johnny.
 
No need for stinkin' manuals when RhythmAce is on the job ;-) When you create a directory container within a vhost container, you know that what you put in the directory container only applies to that vhost's directory don't you? Well now when you create a directory container a directives only apply to that directory and all directories under it. If you want to change some directives for a particular subdirectory and don't want them to apply to all the rest, then you can create a nested container whithin the first one for that particular. Note that the scope of the new directives apply to all subdirectories under this new one but no others. Look at it this way. When parents set rules for their kids, they don't apply to the neighbor's kids. But if their kids bring happy little grandkids into their home, those rules will apply to them too.
 
hay guys,,,its working,i mean all the Folders are opening.
like
..
I had it right along. oh well.
Now the work,changing all my link addresses,from one
server to this one.
Thanks for all the help.
and Support.
Have a nice day.
Johnny/ now with a smile on.
 
For what its worth.Im adding more folders or as many as
i want by just adding another line in the same V.H.
######### I hope this will help the next new bee.and i
hope it's right.
###########
<VirtualHost *:80>

ServerAdmin yourname@yahoo dotcom
DocumentRoot "/Apache Group/Apache2/htdocs/homerepairs"
#######Just added lines below to try 1-27-07 jrb
DocumentRoot "/Apache Group/Apache2/htdocs/homerepairs/site"
DocumentRoot "/Apache Group/Apache2/htdocs/homerepairs/header"
ServerName your name.is-a-geek.net
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>
#######################
the new folder would be under the "Documentroot.
its working for me.
Tks to all on this forum.
 
No, there should only be 1 DocumentRoot. I'm surprised that apache does't throw an error when you restart with multiple DocumentRoot's. You shouldn't need to do anything special for any folders under the DocumentRoot.
 
I say we mug this guy for not paying us no never mind. To add a directory under your one and only DocumentRoot you don't have to do anything. Nothing at all. Zip. Nix. Nada. Zilch. Catch my drift? Dig where I'm coming from? Hip to my jive? Is that a big 10-4? Ya copy? Got your ears on good buddy? C'mon back!
 
If that's you entire Vhost container, I can see you problem. No Directory container. Lets add one.
Code:
<VirtualHost *:80>
    ServerAdmin webmaster@domain1.com
    DocumentRoot /var/[URL unfurl="true"]www/domain1/html[/URL]
    ServerName domain1.com
    ErrorLog /var/[URL unfurl="true"]www/domain1/logs/error_log[/URL]
    CustomLog /var/[URL unfurl="true"]www/domain1/logs/acess_log[/URL] common


    <Directory "/var/[URL unfurl="true"]www/domain1/html">[/URL]

       Options Indexes FollowSymLinks
       AllowOverride None
       Order allow,deny
       Allow from all

    </Directory>

    ScriptAlias /cgi-bin/ "/var/[URL unfurl="true"]www/domain1/cgi-bin/"[/URL]

    <Directory "/var/[URL unfurl="true"]www/domain1/cgi-bin">[/URL]
       AllowOverride None
       Options None
       Order allow,deny
       Allow from all
    </Directory>

</VirtualHost>

This is more what a vhost container should look like. Of course you would change the paths to mach your setup. Note the directory containers within the vhost container? They tell apache who can do what in those directories and their sub-directories. I hope this clears things up for you. You should be able to copy and paste this into your config file any time you want to add another vhost.
 
OOP;S...........OOP'S
Ok. tks RhythmAce
Im going to crawl under the desk now,this way noone will
see me. ha ha ha
oh I never did restate my machine.
I will try what you told or showed me.
Thats after get out from under the desk.
ha ha ha
[im sorry]
could i use the excuess because im 59?
oh~~~~~~~~~~~ well
let me tell you that I HEARD you all the way over here.
you guys got me laughing soooo much now.
Look at it this way,now you have something to talk about to your friends.
c
u
later
&
tks
Johnny,from under the desk.
oh I got a good one to tell you later.Im going to try to
find the small problem .oh everything is working,but im
getting two different index pages showing up on my server and my other machine. ha ha ha
lol
Thanks for making my day.Im still laughing.
 
rhythmace. this line
<Directory "/var/The know is a Folder,the domain1 [would be my
homerepairs folder] is a sub folder
in the is also a folder,[in my homerepairs folder.
But what dose var stand for.when i read about it,it was
used in lenox.I have xp.
would that line be for me.
<Directory "/var/htdocs/homerepairs">
I dont have a what I have is
c
-program files
-apache
-apache group
-apache2
-htdocs/+homerepairs/+links
+homerepaire_image
Thanks Johnny
 
The path was just an example. I just used a path that is commont on redhat linux. You can actually have your RootDirectories anywhere you want on your hard drive. The common practice is to create a directory (folder) that will contain all your websites. To make the paths shorter try to keep that directory right off the root (C:\). Lets say you want to call this directory web, you would create a new directory called c:/web. Now each domain you host should have its own webspace so create a folder inside c:/web that will let you know whos folder that is. So if you have a domain named domain1.com, you could name it c;/web/domain1. Now inside of domain1's folder you want a place for his html files. On Win32 systems this is generally htdocs and on linux systems it is more commonly called html. So now we have c:/web/domain1/htdocs. Some people place there cgi-bin inside there DocumentRoot but using the ScriptAlias directive in httpd.conf does the same thing, so I put it in the same folder as htdocs. So we have c:/web/domain1/cgi-bin. Some people call this scripts instead of cgi-bin. I also keep each domain's logs there so they can access them for traffic reports and so on. So this directoy is c:/web/domain1/logs. If you never plan on having more tha one domain, then you can place your domains webspace folder right at the root i.e. c:/domain1. If you really are a carefree spirit you can put you htdocs, cgi-bin and log directory in the root directory also. What the heck, put everything in the same directory. ;-) My point is, it doesn't matter where anything goes as long as you tell apache where it is. As long as the layout makes sense to you, that's all that matters.

 
RhythmAce
Thank you very much.You sure did help me out and now I
feel better.
What you explained about Vir.Host, I know will help out
others on this board.
Like I said before,the guys here are Great and VERY
helpfull.And that's good.
I had different business and when I hired someone I always
told them to ask questions on how to do it,No matter how
silly they seemed.Because if you don't know it how could
you do it and also how could you help out the other person.
Again,thanks to you and everyone else.
Johnny
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top