The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   Networking (http://hintsforums.macworld.com/forumdisplay.php?f=14)
-   -   Apache working great, but one small problem (http://hintsforums.macworld.com/showthread.php?t=3981)

jeffo 07-09-2002 01:03 PM

Apache working great, but one small problem
 
Ok, here it is. I am using my iMac as my webserver. The specs are below. It has been working great, but I have one small problem that I cannot seem to find the answer to. I have a folder that I am constantly dumping files into for other people to download and such and they are temporary so I dont want to make an HTML file for them to view to download them. I also don't want to have to give them any special directions for ftping or anything. I tell them to go to HTTP://HOST.com/~USER/downloadfolder/ and this will work great. It will spit out a listing of the files and then they jsut click on what they want. If i move the "downloadfolder" out of the "~USER" folder and into the directory for the machine webpage so it would be HTTP://HOST.com/downloadfolder/ it will just not work. It will not give a directory listing. I have even tried to move it further down in the directories such as HTTP://HOST.com/folder/downloadfolder/ and that did not work either. I really want it at the location i am having troubles with and not in a User's directory. I will hail anyone as king if they can help me out.

jeffo

rusty 07-09-2002 02:14 PM

It could be a permissions issue. I might suggest putting the download folder in the place that you want it and then:

sudo chown -R root:www /path/to/downloadfolder

sudo chmod -R 755 /path/to/downloadfolder



Rusty

jeffo 07-09-2002 02:31 PM

I forgot to include that part. I have already tried to alter the permissions to several different things and also i tried to change the owner and group to different owner and groups with the same results. good thoughts though i think, thanks.

jeffo

rusty 07-09-2002 02:36 PM

Quote:

I have already tried to alter the permissions to several different things
Are you sure you tried 755? If the world execute bit is off on the directory, you'll have problems.


Anyway, you might mention exactly what the symptoms are when trying to access the folder. Does the browser show a Forbidden message or what?


Rusty

jeffo 07-09-2002 02:40 PM

it does display a forbidden message of some sort. I would try it right now but i am at work. I thought i tried the 755 perms but i could be wrong, it has been known to happen before. i will try again when i get home.

thanks
jeffo

rusty 07-09-2002 02:48 PM

OK, yeah. Make sure you're placing downloadfolder in /Library/Webserver/Documents/ (unless you've changed the site root in httpd.conf), and then try the chown and chmod exactly as noted above, and if that doesn't work, let the forum know.


Rusty

jeffo 07-09-2002 02:51 PM

i have changed the root of the directories. on my model imac i cannot have the boot partition be larger than 8 gig and i have an 80 gig in there so it is in two parts. the larger part i mounted in /users with the fstab file. all the users and web stuff is in that partition for space reasons.

rusty 07-09-2002 03:01 PM

So you are saying you edited DocumentRoot in httpd.conf?

Apple's default, I believe, is:

Code:

DocumentRoot "/Library/WebServer/Documents/"
What is yours set to?

Also, are you able to load anything from your site root directory (ie: an index.html page)?


Rusty

jeffo 07-09-2002 04:48 PM

Yes i did edit the httpd.conf file. i changed it to /users/[foldername] and every html file i put in there works great and always has.

cosmid 07-09-2002 05:28 PM

Could it be that index listings are not allowed in that directory?
In your httpd.conf file, for that directory you need something like:
Code:

<Directory "/users/[foldername]">
    ...
    Options Indexes
    ...
</Directory>

Just a thought.

/cosmid

jeffo 07-09-2002 07:25 PM

I came home and tried to create a new folder with all the paths to it and including this new folder with the perms of 755 and it still would not work. I got this message in the browser.

Forbidden
You don't have permission to access /downloadfolder/ on this server.

I was searching through the httpd.conf file and on line 395 using pico i found a line that said this:

Options Indexes FollowSymLinks MultiViews

I removed the word Indexes and then saved and restarted apache and it still did not work. It was basically in the same format that cosmid pointed out, but there was items commented out.

cosmid 07-09-2002 07:38 PM

what about the allow and deny lines for that directory?
Is it set to:
Code:

Order allow,deny
Allow from all

/cosmid

jeffo 07-09-2002 08:02 PM

this is what most of that says
 
Options FollowSymLinks MultiViews

# I removed the word Indexes from right after the word Options with
# a space on each side.
#
# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options", "FileInfo",
# "AuthConfig", and "Limit"
#
AllowOverride None

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>

Jadey 07-09-2002 11:13 PM

Oh, don't remove Indexes, you need that in there to allow directory listings. cosmid had the right idea. Try allowing indexes specifically for that directory. ie:


<Directory "/Library/WebServer/downloadfolder">
Options Indexes MultiViews
</Directory>

jeffo 07-10-2002 12:47 PM

I put the "Indexes" option back in the line i removed it from and still nothing after restarting apache.

Then, I added a new section specifically for that directory with the options of "Indexes" and "MultiViews" and it now works fine.

THANK YOU THANK YOU THANK YOU, I am straight but i would kiss ya if i could!

I do have one last question. What is the MultiViews option.

Jeffo

bakaDeshi 07-10-2002 02:29 PM

Language stuff

hayne 07-10-2002 02:33 PM

Apache has a FAQ
 
The original question (about how to get directory indexes) and the one about MultiViews can both be answered by looking at the Apache FAQ page:
http://httpd.apache.org/docs/misc/FAQ.html

Anyway, here is what it says about MultiViews:
> What are "multiviews"?
> "Multiviews" is the general name given to the Apache server's ability to provide > language-specific document variants in response to a request.

jeffo 07-10-2002 04:30 PM

Thanks
 
Thank you all for the info, you have all been great.

Jeffo

jeffo 07-11-2002 10:25 AM

i just noticed this ....
 
I am able to gain access to a directory listing of the folder i want to now, I have my webserver serving three domain names and the folders for these three domains are listed in the same level of the hiarchy. The downloadfolder that i now have access to is inside domain1 folder. when i type in http://domainname1/downloadfolder it gives me access to this folder like it should and have been wanting it too. This next thing is what i am noticing now. If it type in http://domainname2/downloadfolder or http://domainname3/download folder it will take me to the same download folder inside the domainname1 folder. In fact that is the only place i have a downloadfolder. domainname2 and 3 do not have such a folder in them. any ideas on how i can keep 2 and 3 from showing me the downloadfolder contents?

thanks for your help.

jeffo

rusty 07-11-2002 10:27 AM

You should probably post your Virtual Hosts directives in httpd.conf so folks can pick through them, and troubleshoot from there.


Rusty

jeffo 07-11-2002 08:26 PM

here are my virtual hosts
 
NameVirtualHost *
ServerName *

<VirtualHost 192.168.0.3>
#ServerAdmin webmaster@ozzieburn.com
DocumentRoot /Users/ozzieburn
ServerName www.ozzieburn.com
ErrorLog /private/etc/httpd/logs/www.ozzieburn.com_error_log
CustomLog /private/etc/httpd/logs/www.ozzieburn.com_access_log common
</VirtualHost>

<VirtualHost 192.168.0.3>
#ServerAdmin webmaster@ozzieburn.com
DocumentRoot /Users/ozzieburn
ServerName ozzieburn.com
ErrorLog /private/etc/httpd/logs/ozzieburn.com_error_log
CustomLog /private/etc/httpd/logs/ozzieburn.com_access_log common
</VirtualHost>

<VirtualHost 192.168.0.3>
#ServerAdmin webmaster@ozzieburn.com
DocumentRoot /Users/ozzieburn
ServerName coruscant.ozzieburn.com
ErrorLog /private/etc/httpd/logs/coruscant.ozzieburn.com_error_log
CustomLog /private/etc/httpd/logs/coruscant.ozzieburn.com_access_log common
</VirtualHost>

<VirtualHost 192.168.0.4>
#ServerAdmin webmaster@ozzieburn.com
DocumentRoot /var/www/html
ServerName endor.ozzieburn.com
ErrorLog /private/etc/httpd/logs/endor.ozzieburn.com_error_log
CustomLog /private/etc/httpd/logs/endor.ozzieburn.com_access_log common
</VirtualHost>

<VirtualHost 192.168.0.5>
#ServerAdmin webmaster@ozzieburn.com
DocumentRoot /Users/naboo
ServerName naboo.ozzieburn.com
ErrorLog /private/etc/httpd/logs/naboo.ozzieburn.com_error_log
CustomLog /private/etc/httpd/logs/naboo.ozzieburn.com_access_log common
</VirtualHost>

<VirtualHost 192.168.0.3>
#ServerAdmin webmaster@ozziebaby.com
DocumentRoot /Users/ozziebaby
ServerName www.ozziebaby.com
ErrorLog /private/etc/httpd/logs/www.ozziebaby.com_error_log
CustomLog /private/etc/httpd/logs/www.ozziebaby.com_access_log common
</VirtualHost>

<VirtualHost 192.168.0.3>
#ServerAdmin webmaster@ozziebaby.com
DocumentRoot /Users/ozziebaby
ServerName ozziebaby.com
ErrorLog /private/etc/httpd/logs/ozziebaby.com_error_log
CustomLog /private/etc/httpd/logs/ozziebaby.com_access_log common
</VirtualHost>

<VirtualHost 192.168.0.3>
#ServerAdmin webmaster@ozziebaby.com
DocumentRoot /Users/ozziebaby
ServerName coruscant.ozziebaby.com
ErrorLog /private/etc/httpd/logs/coruscant.ozziebaby.com_error_log
CustomLog /private/etc/httpd/logs/coruscant.ozziebaby.com_access_log common
</VirtualHost>

<VirtualHost 192.168.0.3>
#ServerAdmin webmaster@bayknoll.org
DocumentRoot /Users/bayknoll
ServerName www.bayknoll.org
ErrorLog /private/etc/httpd/logs/www.bayknoll.org_error_log
CustomLog /private/etc/httpd/logs/www.bayknoll.org_access_log common
</VirtualHost>

<VirtualHost 192.168.0.3>
#ServerAdmin webmaster@bayknoll.org
DocumentRoot /Users/bayknoll
ServerName bayknoll.org
ErrorLog /private/etc/httpd/logs/bayknoll.org_error_log
CustomLog /private/etc/httpd/logs/bayknoll.org_access_log common
</VirtualHost>

<VirtualHost 192.168.0.3>
#ServerAdmin webmaster@bayknoll.org
DocumentRoot /Users/bayknoll
ServerName coruscant.bayknoll.org
ErrorLog /private/etc/httpd/logs/coruscant.bayknoll.org_error_log
CustomLog /private/etc/httpd/logs/coruscant.bayknoll.org_access_log common
</VirtualHost>

rusty 07-11-2002 10:19 PM

I could be wrong, but given the fact that you have specified IP addresses in your <VirtualHost 192.168.0.4> tags, I think you will want to replace:

NameVirtualHost *
ServerName *

with

NameVirtualHost 192.168.0.3
NameVirtualHost 192.168.0.4
NameVirtualHost 192.168.0.5



Rusty

jeffo 07-12-2002 09:08 AM

most likely
 
That would make sense. I am just flyin by the seat of my pants. This is the first time I have done this type of thing to this extent. The .4 and .5 entries were not working so this is hopefully why. I will add the new changes and let you know.

Thanks
jeffo

jeffo 07-12-2002 10:28 AM

yes and no
 
I have replaced

NameVirtualHost *
ServerName *

with

NameVirtualHost 192.168.0.3
NameVirtualHost 192.168.0.4
NameVirtualHost 192.168.0.5
SeverName *

and this did fix the problemof being able to access the downloadfolder from any of the three domain names and now it is only accessable from the one that i wanted it to be.

You might have noticed though in my virtual host listing in the previous post i have three IPs listed. This was from an experiment that i did not even know if it was possible or not. maybe some of you knowledgable fellows will be able to tell me if i am trying to do something that is not possible.

I have one ip coming into my house and then a router with several computers behind the router. I have two X boxes and a YDL box that i have apache running on all of them. i have set up it set up from the registrar for the domain names to have the three computer names at the same domain name to go to the same ip. for example:

naboo.ozzieburn.com
coruscant.ozzieburn.com
endor.ozzieburn.com

all are going to my IP.

I was trying to get apache on coruscant to separate them to go to the appropriate computer.

naboo and endor are only going to be hit by me so i am not worried about traffic load on coruscant. is this even possible.

jeffo

rusty 07-12-2002 11:31 AM

Let me see if I can touch on a few of these things. Take them for what they're worth:

I believe that your:

SeverName *

is killing you in terms of your Virtual Host setup. As I see it, you should eliminate that line completely. With that line, I believe you are essentially telling apache that ANY server name is a match, and since that ServerName directive is outside of your Virtual Host directives, all hits are being directed to your default site root instead of being processed by the name matches in your Virtual Hosts directives. At worst I believe this will totally negate your Virtual Host setup, and at best I think it will at least cause some problems. I could be wrong.

This documentation will likely be of use to you.


Next, with only one external IP address as you say you have, I can't think of any way to accomplish what your after in terms of routing different domain names to different internal IPs, though that doesn't mean it can't be done. If you really want to direct external traffic to different machines on your internal network, you'd probably have to use non-standard ports in your URLs. (ie: port 80 maps to X box 1, port 6080 maps to X box 2, and port 7080 maps to linux box)


If you were just running one machine as a webserver, I would do it like this:

Have your DNS point all desired domain and hostname permutations to your external IP address (which you've already done).

On your router, map all incoming port 80 traffic to a single box on your internal network. Let's say 192.168.0.3. (I'm not sure if you've already done this or not.)


In httpd.conf,

precede your Virtual Host directives with:

NameVirtualHost *

(but do NOT include ServerName *, as I discussed!)


Then set up virtual hosts with one directive for each differing DocumentRoot:

<VirtualHost *>
#ServerAdmin webmaster@ozzieburn.com
DocumentRoot /Users/ozzieburn
ServerName www.ozzieburn.com
ServerAlias ozzieburn.com coruscant.ozzieburn.com
ErrorLog /private/etc/httpd/logs/www.ozzieburn.com_error_log
CustomLog /private/etc/httpd/logs/www.ozzieburn.com_access_log common
</VirtualHost>

<VirtualHost *>
#ServerAdmin webmaster@ozzieburn.com
DocumentRoot /Users/naboo
ServerName naboo.ozzieburn.com
ErrorLog /private/etc/httpd/logs/naboo.ozzieburn.com_error_log
CustomLog /private/etc/httpd/logs/naboo.ozzieburn.com_access_log common
</VirtualHost>

<VirtualHost *>
#ServerAdmin webmaster@ozziebaby.com
DocumentRoot /Users/ozziebaby
ServerName www.ozziebaby.com
ServerAlias ozziebaby.com coruscant.ozziebaby.com
ErrorLog /private/etc/httpd/logs/www.ozziebaby.com_error_log
CustomLog /private/etc/httpd/logs/www.ozziebaby.com_access_log common
</VirtualHost>

And so on...



Let me know if any of this does or does not make sense.

Rusty

jeffo 07-12-2002 01:05 PM

this seems like a much cleaner way to do it than what i was thinking. thanks. will try when i get home.

jeffo

jeffo 07-19-2002 11:05 AM

sorry about the long delay in the post, i had some other more important stuff come up. I have changed the formatting to the way tha rusty has suggested and i like it alot better since it is so much easier to follow. The only downside that i can see is that i used to have my logs split up so i could see how much www.ozzieburn.com and ozzieburn.com got hit and tht type of thing, but that was actually kind of a pain anyways and was not that important to me so i forgot about it. i have also abandoned trying to have apache reroute some traffic and used different ports since i am the only one that hits the other computers.

jeffo

Jadey 07-22-2002 06:04 PM

Quote:

Originally posted by jeffo
THANK YOU THANK YOU THANK YOU, I am straight but i would kiss ya if i could!
I'm a girl, but that's quite alright, no kiss necessary. :D

I just wanted to mention the ServerAlias feature. If you have 2 domains served out of the identical directory, there's no need to specify a <VirtualHost> for both of them. All you have to do is:

ServerName www.ozzieburn.com
ServerAlias ozzieburn.com

within just one <VirtualHost> :)

jeffo 07-22-2002 11:07 PM

Sorry jadey
 
sorry about that *kisses* for you then. thanks for all your help. just assuming most computer geeks are men.

jeffo 10-07-2002 08:54 PM

virtual host problem
 
ok mly setup has been working great thanks to all the previous help. recently a friend of mine asked me to temporarily host his website while he took his winblows box down to reinstall and test out a couple forms of linux instead of MS OS. His site is up and running great and everything is working great as far as anyone except for me can see. it is logging the hits to his website in the wrong log file and i cannot figure out why. the following is the virtual host for his site on my machine:

<VirtualHost 192.168.0.3>
#ServerAdmin webmaster@crashgraphics.com
DocumentRoot /Users/crash/WebSite
ServerName coruscant.crashgraphics.com
ServerAlias crashgraphics.com www.crashgraphics.com
ErrorLog /private/etc/httpd/logs/crash_error_log
CustomLog /private/etc/httpd/logs/crash_access_log common
<Directory "/Users/*/Sites">
Deny from all
</Directory>
</VirtualHost>

i know someone is going to ask why i renamed the Sites folder to WebSite, so here is the answer. when they were all named Sites, you could type in http://anydomainname.com/~username and hit that users name in all of them, i did not want this. i wanted only one domain name to do that.

when i delete all of the log files and then bounce apache it recreates all of the log files but this domain will not not log into the crash log files that it creates, instead it puts them into my main website log file. i have compared the virtual host entries many, many times and they are to the letter the same. The only thing that i can think of that is not consistent between my three domains and my friends is that i have my entries through the same domain name server and his is through another registrar. would that make a difference?

thanks again in advance
jeffo


All times are GMT -5. The time now is 07:41 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.