PDA

View Full Version : Apache setup question




yg17
Jan 17, 2005, 03:36 PM
Hello,

I have a Powermac G5 with Panther, Apache, PHP and MySQL. I write and test PHP scripts on it. But, how can I setup Apache so it can only be accessed through localhost? I'm on a college campus network and IT is strict about running servers, so is it possible to make the server appear to be nonexistant to the rest of the network without me actually having to unplug the network cable? thanks



whocares
Jan 17, 2005, 07:13 PM
I can think of 2 ways:

1. Change the port in httpd.conf (located at /etc/httpd/httpd.conf - root password required) --> http request usually use port 80;

2. Add the following at the end of httpd.conf and restart webserver :

<Directory /Users/*/Sites>
deny from all
allow from localhost
</Directory>

This will bloc access to your websharing directories from machines that arn't your local one.

You may want to do the same for the '/Library/WebServer/Documents' folder, which is the document root and contains Apache documentation.

-------

To edit the httpd.conf file (following are terminal commands),

1. Back it up:
sudo cp /etc/httpd/httpd.conf /etc/httpd/httpd.conf.old

2. To edit it:
sudo pico /etc/httpd/httpd.conf

Each time you change it, you need to restart the webserver: System Prefs->Sharing->WebSharing Off & On again.

sgarringer
Jan 17, 2005, 08:41 PM
Editing the httpd.conf will prevent people from accessing files on the server, but the server will still respond to requests on the http port (IE: it will say "Go away") However, most network scanning software will still flag it as an active server.

Better option is to use the OS X firewall to prevent access to the server. Thay way when something trys to connect, it wont even respond.

whocares
Jan 18, 2005, 08:15 AM
Better option is to use the OS X firewall to prevent access to the server. Thay way when something trys to connect, it wont even respond.

Yeah, that was my first thaught, but you can't block the port 80 if your websharing is running. At least not easily through System Prefs...

monkeydo_jb
Jan 18, 2005, 09:46 AM
Alternatively, you could just uncomment the 'Listen' line and make it look like this:


Listen: 127.0.0.1:80

sgarringer
Jan 18, 2005, 10:11 AM
Alternatively, you could just uncomment the 'Listen' line and make it look like this:


Listen: 127.0.0.1:80

yes, I do believe we have a winner.

monkeydo_jb
Jan 18, 2005, 11:08 AM
yes, I do believe we have a winner.


Do I get a prize? Hopefully is something cool like a way to get a free iPod...

sgarringer
Jan 19, 2005, 11:06 AM
Do I get a prize? Hopefully is something cool like a way to get a free iPod...

Swat the fly, win a prize!

I'm sure you'll see a banner for it on this site, just keep hitting refresh =]