Forum Moderators: travelin cat

Message Too Old, No Replies

How do I turn off outside access when I'm developing offline?

         

roldar

8:36 am on Jan 29, 2005 (gmt 0)

10+ Year Member



Well I took the plunge and got myself a mini mac after 12 years of windoze.

Now I'm trying to get things set up as I had them on my crash box, but am running into one small problem. I want to use my mac for offline development so that I don't have to ftp my files up every time I make changes.

I've figured out how to get apache up and running using the Personal Web Sharing button in System Preferences, but I am a little concerned by the fact that this allows people access to my computer. I realize they can only see what's in and below the localhost folder, but I'd rather not give a snooper access to what I'm working on. I've also noticed that when this is enabled it allows me to connect to my site via my IP address and browse all my php files even when there's an index.php in the folder. If I kept my mysql connection information in the development folder somebody could just copy it and get my password. (I think) I may not have php set up correctly yet, so maybe that's the reason why the index.php isn't being opened automatically.

So, is there any way for me to use apache/php/mysql on my computer without giving outside access? Whenever I turn on the Personal Web Sharing it requires that the software firewall open up that port.

Thanks!

BjarneDM

11:12 am on Jan 29, 2005 (gmt 0)

10+ Year Member



php is not set correctly up - in fact, right out of the box the Apache server in Mac OS X hasn't switched php on at all.

I'll recommend the following: drop using the Apple WebSharing and download the three components - Apache, PHP and MySQL - from Serverlogistics [serverlogistics.com]. They are playing very niecely together and integrates fuly with the normal ways (StartupItems and Preference Panes) in Mac OS X. You can get instructions and scripts from my website (link in profile) on how to upgrade the ServerLogistics packages.

As to blocking from the outside, when you switch on WebSharing you also open the corresponding ports in the Apple firewall. That's not the case for the ServerLogistics solution: if you turn the firewall on there's no access to the webserver.

As to placing the login-information so that it can't be read by browsers, it's quite simple: you'll just have to specify a path in your php configuration for the php-includes that's outside the web-root. In that folder you can 'hide' confidential information

Try taking a look at the following thread in this forum:
[webmasterworld.com...]

And try going through this forum looking for interesting threads - there's a lot of information that might very possibly be of use to you.

timster

6:13 pm on Jan 31, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Depending on how thoroughly you want to hide your development site, you might just want to switch the port Apache uses. That can make it much harder for nosy neighbors to log into your site without locking yourself out entirely.

Regarding users being able to browse directories when there's no index.php, yes definitely do as BjarneDM suggests (moving sensitive functions out of the document root). You'll want to configure your httpd.conf file to add index.php to your list of "index" pages.

[httpd.apache.org ]

Make sure you understand what you're doing, though, before you edit httpd.conf.

jamesa

6:59 am on Feb 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The reason why you're seeing the PHP source code, is that PHP isn't enabled in Apache. All you need to do is open httpd.conf and uncomment the following lines:

#LoadModule php4_module
#AddModule mod_php4.c
#AddType application/x-httpd-php .php
#AddType application/x-httpd-php-source .phps

After you uncomment them they'll look like:

LoadModule php4_module
AddModule mod_php4.c
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

Then just restart Apache using the checkbox in System Preferences. Here's more details:

Apache Web-Serving with Mac OS X: Part 3 [macdevcenter.com]

That covers PHP... there's really no need to do your own installations of PHP and Apache unless you need to compile in additional features.

-----

RE MySQL... I've done it two ways. One is to compile from source (get the source file from mysql.com's site)... and two, was to install fink and then install mysql using fink. I recommend the later. It's simpler, and fink keeps all the programs you install segregated in it's own directory.

Again there's really no need to re-install Apache and PHP unless you have a special reason to.

-----

RE outside access, configure your Firewall. See System Prefs-> Sharing-> Firewall. If that causes a problem with connecting via localhost or 127.0.0.1 (don't know if it will) then you might need to write your own IPFW rules.... do some searches on the net, or check out BrickHouse for a more advanced firewall GUI.

BjarneDM

11:49 am on Feb 1, 2005 (gmt 0)

10+ Year Member



jamesa:
RE outside access, configure your Firewall. See System Prefs-> Sharing-> Firewall.
The problem with the Apple Firewall is that if you turn on 'Personal Websharing' you'll also open the corresponding ports in the firewall. Localhost and 127.0.0.1 will work as expected also on a computer with all ports closed by a firewall. Thus, you'll need another firewall if you go with Apple Websharing.

That covers PHP... there's really no need to do your own installations of PHP and Apache unless you need to compile in additional features.
The ServerLogistics packages comes with Apache2 and a PHP for that with a lot of nice extras. If you want the new PHP v5.0.x you'll need to compile it for youself if you want php5 support for the Serverlogistics packages, or make a install from Marc Linyarge if you want support php5 for Apples Apache 1.3.x. I've instructions on how to compile PHP5 for Servelogistics on my homepage (see link in my profile)