PDA

View Full Version : Setting up a Web Server on Mac OS X


Banana
2009-11-28, 12:38
So I have a situation where I decided the answer would be to run a temporary web server to share contents with a group of people. I went about on setting up the Web server but in proceed, got confused and quite nervous that it was totally insecure.

So, I'm hoping for some clarity on what I'm supposed to expect.

My network setup: A stupid DSL modem/router with its useless firewall off. My iMac with a static IP assigned and firewall on.

Questions:

1) When typing in my external IP, I'm taken to my modem homepage! That quite freaked me out, but if I run it through a proxy server, it goes to the intended page... Is that expected? I'd hate to have my modem's ass flapping out in the wind, even though I've checked to be sure that "remote management" is disabled and I don't use default admin/password. Is it safe to assume it's just a result of IP resolved by the modem to itself as it originated in LAN, rather than modem streaking on the internet?

2) I get inconsistent results. If I use internal IP, everything works as expected. With external IP (via proxy server), I can get to the same page but the movie (actually a flash object... please forgive my mortal sin here :o...) doesn't load... I've already verified that all files in the /Library/WebServer/Documents has the Read-Only permissions for everyone. I think I missed a step here...

3) I had started out fully expecting that port forwarding would be necessary. However, through an accident, I found it wasn't even necessary at all. Even though the modem's firewall is off, NAT is on, so naturally, I'd have expected it to get lost without the appropriate port forwarding... Is the cake a lie?

4) Is it possible to setup a simple authentication required to visit the website?

ast3r3x
2009-11-28, 13:42
I'd set your modem/router to use that static IP address and just forward port 80 to your iMac.

Of course if you want to keep it set up as it is, make sure your iMac is setup using the static IP address and you are accessing the static address, not the gateway address they would have given you as well.

For simple authentication you probably just want to setup an .htaccess file if you are using apache.

Banana
2009-11-28, 14:42
I'd set your modem/router to use that static IP address and just forward port 80 to your iMac.

I had my iMac set up with DHCP & manual address because there is no way for me to set a static address within modem. Cheap junk. :rolleyes: I might as well and put in the port forwarding anyway, though I can't help wonder how the hell it manages to work without that set up.

Of course if you want to keep it set up as it is, make sure your iMac is setup using the static IP address and you are accessing the static address, not the gateway address they would have given you as well.

To clarify, if i go to 192.168.0.X, it all works. I've not tried going to 192.168.0.1 (e.g. the gateway address). However if I use my external address (e.g. what I get if I go to whatismyip.com), it takes me to my modem home page. :eek: However, if I use a proxy server and input the same external address, it goes to the intended homepage but movie object doesn't work.

For simple authentication you probably just want to setup an .htaccess file if you are using apache.

Thanks. I'll google this up.

ast3r3x
2009-11-28, 15:03
Try not setting your iMac to use DHCP. I think you want to do everything manually.

I just set up a static IP at our office and we turned off everything on our modem (firewall, dhcp, port forwarding) and then on our router we entered everything manually. They gave us the gateway address (apple refers to this as the router address), ip address (the static ip you were given), a subnet to use, and name servers to use.

Since you don't have a router between you and your modem I'd suspect you'd just want to set your iMac up manually (not using DHCP).

Banana
2009-11-28, 15:46
I've tried the complete manual setup and using my external IP still directs me to my modem's page. :\

As for .htaccess, I got weird behavior- when I changed the httpd.conf's Override None to Override All, I get prompted for password even just to browse to Applenova. Setting it back to None, and .htaccess/.httpaccess are ignored entirely. :\

Brad
2009-11-28, 16:00
Have you tried accessing that IP from somewhere not on your network? Your modem may be routing the request such that you don't see what outsiders would see.

PM me the IP address and I'll try it, if you like.