Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jammer08

macrumors member
Original poster
May 26, 2006
63
0
Hello, I am trying to host a website on a Macbook. I will be using the Macbook as a dedicated server for my company. I have started personal web sharing in system preferences, and have added the pages to the "Sites" folder... The issue is, when I try to access the website from a computer other than the host, it says I do not have permission to view the page -- how to I go about fixing this? Any help would be greatly appreciated.

Thanks-
Justin
 

panoz7

macrumors 6502a
Nov 21, 2005
904
1
Raleigh, NC
You need to have the files in the webserver folder. Its found in library/webserver/documents. I think the sites folder is just for iWeb stuff... i've never used it so I'm not positive though.
 

jammer08

macrumors member
Original poster
May 26, 2006
63
0
panoz7 said:
You need to have the files in the webserver folder. Its found in library/webserver/documents. I think the sites folder is just for iWeb stuff... i've never used it so I'm not positive though.

I will try that - Thank you! :)
 

mkrishnan

Moderator emeritus
Jan 9, 2004
29,776
15
Grand Rapids, MI, USA
If you put something in the sites folder in your home directory, it's supposed to show up in http: // your IP address or DN or local hostname / ~ your user name

It's not for iWeb -- it existed before iWeb did. But you have to have your firewall settings set up so that the requesting computer can see it. If I open my firewall on my iMac for instance, I can see the sites folder from my Axim or iBook, but I can't see it from the extranet, because there's another firewall on my router, right?
 

panoz7

macrumors 6502a
Nov 21, 2005
904
1
Raleigh, NC
mkrishnan said:
If you put something in the sites folder in your home directory, it's supposed to show up in http: // your IP address or DN or local hostname / ~ your user name

It's not for iWeb -- it existed before iWeb did. But you have to have your firewall settings set up so that the requesting computer can see it. If I open my firewall on my iMac for instance, I can see the sites folder from my Axim or iBook, but I can't see it from the extranet, because there's another firewall on my router, right?

Ok... just figured the ~name thing out. What's the point though? Its slightly more convenient to stick stuff in the sites folder, but other then that I see no advantage and its a real pain to have to type in the ~USERNAME thing, especially if you have a strange username.

The firewall has never given me trouble on the internal network. I've never had to turn it off. Maybe the sites folder is different and is safe-gaurded more?
 

SC68Cal

macrumors 68000
Feb 23, 2006
1,642
0
panoz7 said:
Ok... just figured the ~name thing out. What's the point though? Its slightly more convenient to stick stuff in the sites folder, but other then that I see no advantage and its a real pain to have to type in the ~USERNAME thing, especially if you have a strange username.

The firewall has never given me trouble on the internal network. I've never had to turn it off. Maybe the sites folder is different and is safe-gaurded more?

you can configure Apache to change the default directory to your ~ Sites folder
 

mkrishnan

Moderator emeritus
Jan 9, 2004
29,776
15
Grand Rapids, MI, USA
panoz7 said:
The firewall has never given me trouble on the internal network. I've never had to turn it off. Maybe the sites folder is different and is safe-gaurded more?

If you turn Apache on via OS X (i.e. in System Preferences) it automatically opens the associated port on the Firewall. If you have the OS X firewall up, Port 80 absolutely must be open for a webserver to work. No exceptions, really.... You either have to let OS X do it or do it yourself.

As far as the ~username... the idea is like any other managed Unix system -- different users can have different web pages. It isn't always called sites, but having a folder within the user folder is the standard way of doing things in Unix.... This way a user does not need to play with root level files. To which they ought not have write access to begin with. Which is the way it should be. ;)

If you have a domain name, you can always map it onto ~yourusername just as easily as the root.

But in the end, both folders belong to Apache, and there is only one Apache instance. There's nothing special about either folder... just make sure permissions and accessibility are all set up properly.
 

jammer08

macrumors member
Original poster
May 26, 2006
63
0
more confused

now i am really confused -- i have my htm files in the webserver folder. i have the port (80) open, and when i go to my ip address i get the apache page... when i go to my ip/~user i get a message saying i dont have privelege to view this page... the firewall on the macbook is off and the port on my router's firewall is open :confused: :confused: :confused:
 

jammer08

macrumors member
Original poster
May 26, 2006
63
0
BTW-- i have my domain pointed to my ip address. either way i access it (via domain or ip address) i get a permissions error.
 

colocolo

macrumors 6502
Jan 17, 2002
480
132
Santiago, Chile
jammer08 said:
now i am really confused -- i have my htm files in the webserver folder. i have the port (80) open, and when i go to my ip address i get the apache page... when i go to my ip/~user i get a message saying i dont have privelege to view this page... the firewall on the macbook is off and the port on my router's firewall is open :confused: :confused: :confused:

Do not despair :)

There are two possible causes for this:

1.- Permissions have changed on sites folder.

To fix this, select the Sites folder, Get info (either from the File menu, cmd-I or right click-> get info) and then make sure that everyone has read access on the tab Ownership & Permissions. Make sure Others have Read Only access or you'll be in for some big security risk for your site!


2.- You do not have an index.html file and Apache is not configured to list folder contents.

Solution: Put up an index.html page inside your Sites folder, and see if you can access it. If you can, just make sure you rename your homepage! Way easier than fiddling with /etc/httpd/httpd.conf file if you are not used to it.


Good luck!
 

jammer08

macrumors member
Original poster
May 26, 2006
63
0
colocolo said:
Do not despair :)

There are two possible causes for this:

1.- Permissions have changed on sites folder.

To fix this, select the Sites folder, Get info (either from the File menu, cmd-I or right click-> get info) and then make sure that everyone has read access on the tab Ownership & Permissions. Make sure Others have Read Only access or you'll be in for some big security risk for your site!


2.- You do not have an index.html file and Apache is not configured to list folder contents.

Solution: Put up an index.html page inside your Sites folder, and see if you can access it. If you can, just make sure you rename your homepage! Way easier than fiddling with /etc/httpd/httpd.conf file if you are not used to it.


Good luck!


I have checked folder permissions, and yes, everyone has read rights. I actually had moved my pages to the WebServer folder. I do have an index.html file in the WebServer folder.. still saying no permissions.
 

colocolo

macrumors 6502
Jan 17, 2002
480
132
Santiago, Chile
Justin,

either the folder /Library/WebServer/Documents doesn't have read permissions, OR (and i think this might be it) your index.html file doesn't have the right permissions set. check that index.html does have read access to everyone.

By the way, this is not a firewall issue. The message is the standard one from Apache.
 

jammer08

macrumors member
Original poster
May 26, 2006
63
0
colocolo said:
Justin,

either the folder /Library/WebServer/Documents doesn't have read permissions, OR (and i think this might be it) your index.html file doesn't have the right permissions set. check that index.html does have read access to everyone.

By the way, this is not a firewall issue. The message is the standard one from Apache.


You were correct!! -- the index file did not have read permissions for others. THANK YOU very much! :)
 

colocolo

macrumors 6502
Jan 17, 2002
480
132
Santiago, Chile
jammer08 said:
You were correct!! -- the index file did not have read permissions for others. THANK YOU very much! :)

No problem ;)

By the way, you might want to check permissions on your images folder/files as they present the same issue :D
 

jammer08

macrumors member
Original poster
May 26, 2006
63
0
should i leave all of the apache pages in the WebServer folder? also, what is the difference between the Sites folder, and the WebServer folder?
 

SC68Cal

macrumors 68000
Feb 23, 2006
1,642
0
If you want the Apache webserver to serve up a different directory, use terminal

cd /etc/httpd
cp httpd.conf httpd.conf.bak (back up the original file)
nano httpd.conf

Inside that configuration file under section 2:

# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
</change/this/to/whatever/you/want>

And a few lines below that:

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/change/this/to/what/you/changed/above">
 

jammer08

macrumors member
Original poster
May 26, 2006
63
0
SC68Cal said:
If you want the Apache webserver to serve up a different directory, use terminal

cd /etc/httpd
cp httpd.conf httpd.conf.bak (back up the original file)
nano httpd.conf

Inside that configuration file under section 2:

# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
</change/this/to/whatever/you/want>

And a few lines below that:

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/change/this/to/what/you/changed/above">

Do you recommend doing that instead of deleting all of the apache pages in the default directory?
 

colocolo

macrumors 6502
Jan 17, 2002
480
132
Santiago, Chile
jammer08 said:
Do you recommend doing that instead of deleting all of the apache pages in the default directory?

There is no benefit on doing that. If you really want to save all your info, just copy all the files and save it somewhere on your HD.
Unless you have a particular reason to do so, just keep the standard web folder schema.

The difference between the Webserver and the sites folder is, in short, that the webserver folder is your computer's web site. The sites folders are independet for each user of the machine (hence the ~username after the ip address).

If you want to maintain your site on your sites folder (so you dont need root permissions for every single update), just put this code on your index.html on your webserver folder:

<script>
location.href="~username";
</script>

There are tons of alternative ways of doing this (using headers, remapping at http.conf) but I feel this is the easiest way while you get your site admin experience.
 

jammer08

macrumors member
Original poster
May 26, 2006
63
0
colocolo said:
There is no benefit on doing that. If you really want to save all your info, just copy all the files and save it somewhere on your HD.
Unless you have a particular reason to do so, just keep the standard web folder schema.

The difference between the Webserver and the sites folder is, in short, that the webserver folder is your computer's web site. The sites folders are independet for each user of the machine (hence the ~username after the ip address).

If you want to maintain your site on your sites folder (so you dont need root permissions for every single update), just put this code on your index.html on your webserver folder:

<script>
location.href="~username";
</script>

There are tons of alternative ways of doing this (using headers, remapping at http.conf) but I feel this is the easiest way while you get your site admin experience.

This machine will be dedicated to hosting just this one website, so i just assume leave it in the WebServer folder -- shouldn't be too hard to keep track of.

Again, thank you for your help.
 

Wince99

macrumors newbie
Oct 31, 2005
23
0
Montreal
jammer08 said:
This machine will be dedicated to hosting just this one website, so i just assume leave it in the WebServer folder -- shouldn't be too hard to keep track of.

Again, thank you for your help.

Why did you choose a laptop as a dedicated web server? Wouldn't it be less expensive to put a mac mini on the task?

:rolleyes:
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.