New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
Web Design and Hosting Creating sites, scripting, and hosting discussions.

Personal Web Sharing: can't get Aliases to work (Apache expert please!)


Post Reply New Thread Subscribe

 
Thread Tools
fjordaan

 
Member Since: Jul 08, 2007
Posts: 3
fjordaan is on a distinguished road

fjordaan is offline
I want to use Apache on my Mac to test sites I'm working on locally, as I'm accustomed to doing on Windows. Personal Web Sharing is enabled, and I can see the Apache welcome screen on 192.168.0.3 (the Mac's IP address), and the page under MyUserName/Sites/index.html at 192.168.0.3/~MyUserName

However, I store all my work under /Documents/Work/Projectname/, and I don't want to move it all under /MyUserName/Sites.

So what I'd normally do is edit Apache's httpd.conf and add a line like

Code:
Alias /Projectname/ "/Users/MyUserName/Documents/Work/Projectname/"
but as far as I know on OS X you're not supposed to edit httpd.conf (well hidden under /private/etc/httpd/), but should edit /private/etc/httpd/users/MyUserName.conf instead.

Is that correct? Anyway, it doesn't work! I get 403 Forbidden when trying to access html files under 192.168.0.3/MyProjectName/.
QUOTE Thanks
supergper

 
Member Since: Jul 08, 2007
Location: SLC, UT
Posts: 31
supergper is on a distinguished road
Mac Specs: Macbook Pro, 2.2Ghz, 4GB Memory, 120GB HDD, LCD Display, OS X Tiger

supergper is offline
Quote:
Originally Posted by fjordaan View Post
I want to use Apache on my Mac to test sites I'm working on locally, as I'm accustomed to doing on Windows. Personal Web Sharing is enabled, and I can see the Apache welcome screen on 192.168.0.3 (the Mac's IP address), and the page under MyUserName/Sites/index.html at 192.168.0.3/~MyUserName

However, I store all my work under /Documents/Work/Projectname/, and I don't want to move it all under /MyUserName/Sites.

So what I'd normally do is edit Apache's httpd.conf and add a line like

Code:
Alias /Projectname/ "/Users/MyUserName/Documents/Work/Projectname/"
but as far as I know on OS X you're not supposed to edit httpd.conf (well hidden under /private/etc/httpd/), but should edit /private/etc/httpd/users/MyUserName.conf instead.

Is that correct? Anyway, it doesn't work! I get 403 Forbidden when trying to access html files under 192.168.0.3/MyProjectName/.

I've always editted /etc/httpd/httpd.conf and it's always worked fine for me. I'll try and add an alias real quick and report back.
QUOTE Thanks
supergper

 
Member Since: Jul 08, 2007
Location: SLC, UT
Posts: 31
supergper is on a distinguished road
Mac Specs: Macbook Pro, 2.2Ghz, 4GB Memory, 120GB HDD, LCD Display, OS X Tiger

supergper is offline
Quote:
Originally Posted by fjordaan View Post
I want to use Apache on my Mac to test sites I'm working on locally, as I'm accustomed to doing on Windows. Personal Web Sharing is enabled, and I can see the Apache welcome screen on 192.168.0.3 (the Mac's IP address), and the page under MyUserName/Sites/index.html at 192.168.0.3/~MyUserName

However, I store all my work under /Documents/Work/Projectname/, and I don't want to move it all under /MyUserName/Sites.

So what I'd normally do is edit Apache's httpd.conf and add a line like

Code:
Alias /Projectname/ "/Users/MyUserName/Documents/Work/Projectname/"
but as far as I know on OS X you're not supposed to edit httpd.conf (well hidden under /private/etc/httpd/), but should edit /private/etc/httpd/users/MyUserName.conf instead.

Is that correct? Anyway, it doesn't work! I get 403 Forbidden when trying to access html files under 192.168.0.3/MyProjectName/.
Quote:
Originally Posted by supergper View Post
I've always editted /etc/httpd/httpd.conf and it's always worked fine for me. I'll try and add an alias real quick and report back.
alright, I've figured out your problem, the permissions in your homes folder are wrong for allowing access for Apache. If you change the group on all the folders from your homes folder down to Projectname from your user to wheel (and the files inside of them) then you can use that Alias. I don't know what other repercussions this may have but it will solve your Alias problem. The other possible solution (I didn't test it) is use symlinks, point from the webroot directory to Projectname.
QUOTE Thanks
fjordaan

 
Member Since: Jul 08, 2007
Posts: 3
fjordaan is on a distinguished road

fjordaan is offline
Hi supergper, I'd love that to be the solution, but unfortunately not.

I know that Aliases are understood, whether I put them in myusername.conf or in httpd.conf, because without them I just get a 404 Not Found, and with them, 403 Forbidden.

So that leaves file/folder permissions. But the /Users/MyUserName/Sites folder -- which works -- has Read & Write permissions (chmod 755, I think: rwxr-xr-x), and this is exactly the same as the folder I'm trying to use /Documents/Work/Projectname.

One difference: the same permissions apply to /MyUserName, but not to /Documents. The latter is rwx------

Could that make a difference? Surely only the permissions of the relevant folder /Documents/Work/Projectname matter?

Thanks for your help so far.
QUOTE Thanks
xstep

 
xstep's Avatar
 
Member Since: Jun 25, 2005
Location: On the road
Posts: 3,231
xstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to all
Mac Specs: 2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid

xstep is offline
I just played with this out of interest. I had to set execute permission from my personal root folder down the chain to the distination. So...

I altered the users xstep.conf file as you suggested. The I setup the following permission via the command line. I doubt the group permission actually needs to be set.

/User/xstep is set to drwx--x--x
~/Documents is set to drwx--x--x
~/Documents/Work is set to drwx--x--x
~/Documents/Work/Projectname is set to drwx--x--x

I had to set my final target file, index.html, to -rw----r--

So, for what ever reason, read permission all the way down the directory path is NOT needed. Just execute. The files that the browser are going to load require read permission. That included a PHP file I tested against.

One final note. I had to use this format http://localhost/Projectname/ to get to the folder. Note the trailing slash.
QUOTE Thanks
supergper

 
Member Since: Jul 08, 2007
Location: SLC, UT
Posts: 31
supergper is on a distinguished road
Mac Specs: Macbook Pro, 2.2Ghz, 4GB Memory, 120GB HDD, LCD Display, OS X Tiger

supergper is offline
Quote:
Originally Posted by xstep View Post
I just played with this out of interest. I had to set execute permission from my personal root folder down the chain to the distination. So...

I altered the users xstep.conf file as you suggested. The I setup the following permission via the command line. I doubt the group permission actually needs to be set.

/User/xstep is set to drwx--x--x
~/Documents is set to drwx--x--x
~/Documents/Work is set to drwx--x--x
~/Documents/Work/Projectname is set to drwx--x--x

I had to set my final target file, index.html, to -rw----r--

So, for what ever reason, read permission all the way down the directory path is NOT needed. Just execute. The files that the browser are going to load require read permission. That included a PHP file I tested against.

One final note. I had to use this format http://localhost/Projectname/ to get to the folder. Note the trailing slash.
the only issue is you are giving EVERYONE execute permissions by setting it like that. It's safer to change the group to wheel for those same files/directories and be done with it. Both will work as they are both giving wheel/apache the needed permissions.

Also, the reason for the need for the trailing slash is because you setup the alias as /Projectname/ instead of /Projectname (note, no trailing slash)...it doesn't matter which you use, but this is just an explanation as to why.
QUOTE Thanks
fjordaan

 
Member Since: Jul 08, 2007
Posts: 3
fjordaan is on a distinguished road

fjordaan is offline
Problem solved!

I had to chmod /Documents to 755 as well. So all folders in the path (/Documents/Work/Projectname) need to be 755. Can't see why, but there you go.

Thanks for the help, all
QUOTE Thanks
xstep

 
xstep's Avatar
 
Member Since: Jun 25, 2005
Location: On the road
Posts: 3,231
xstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to all
Mac Specs: 2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid

xstep is offline
Quote:
Originally Posted by supergper View Post
the only issue is you are giving EVERYONE execute permissions by setting it like that. It's safer to change the group to wheel for those same files/directories and be done with it. Both will work as they are both giving wheel/apache the needed permissions.
I assumed that fjordaan wasn't concerned about tight security, just a basic answer. But...

If you want to get all technical, I believe the proper group would be www on OSX as that is what the children httpd processes are spawned as after you start httpd up via the Sharing Preferences. When I just tested this, setting group ownership to wheel, httpd couldn't load the file. Changing group ownership to www fixed this issue. Note that I didnt' mess with the directories as I'm pretty much done with this discussion.
QUOTE Thanks

Post Reply New Thread Subscribe


« Free HTML Editor | Quicktime »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Web Browsers novicew OS X - Apps and Games 80 04-10-2010 11:02 AM
Personal Web Sharing Dodoo jacobonline OS X - Operating System 0 01-20-2006 02:10 PM
personal web sharing the_New_guy OS X - Operating System 2 03-15-2005 09:33 AM
Getting old personal laserwriter NT to work on IMAC/os x 10.3.5 cmckenna82 Other Hardware and Peripherals 2 10-20-2004 03:03 PM
Personal File Sharing keeps un-checking itself... bkpr OS X - Operating System 3 12-13-2003 03:57 AM

All times are GMT -4. The time now is 07:25 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?