Make a MAMP Server Available Externally

Technical

Although I've been running something of an alternative development environment for a while, I recently decided - for reasons of convenience that I won't go into here - that I wanted start running a truly local development environment if I could find a way to do so in a reasonably elegant manner. In this case, "elegant" is really just a not-so-sophisticated codeword for "self-contained", "encapsulated" or "bundled". In short, I didn't - and don't - want my Mac to be a web server, I just want it to run a web server.

Most of what I'm doing these days involves PHP, so a bundled AMP (Apache, MySQL, PHP) stack seemed appropriate for my needs. There are a number of bundled stacks for Linux and, quite predictably (and fortuitously), there are at least a few for Mac. I settled on the free version of MAMP.

Everything went smoothly until I tried to test my first locally developed web application on IE using my Windows XP virtual machine - I was unable to connect to the server running on my Mac. I wasn't expecting that. After a little head scratching, I realized what was going on. What follows is a description of the steps I took to make my MAMP web server available to other machines within my network.

For the impatient figure-it-out-for-yourself-ers among us: look at your services and firewall settings in System Preferences.

For those interested in a more verbose explanation, I should start by stating that MAMP's web server does not run on port 80 by default. I assume this was done in order to prevent a conflict with OS X's built-in Apache server in case both were running; the built-in web server also listens on port 80 by default. Because I have no plans to use both servers simultaneously and I'm too lazy to add a port specification to every URI I type, I configured the MAMP-installed Apache server to listen on port 80.

To make a MAMP-installed Apache server available to machines other than the one it's installed on, first ensure that Personal Web Sharing is disabled. Enabling this service will start OS X's built-in Apache server and create a conflict since both servers are trying to listen on the same port. I honestly don't recall whether I had that enabled before trying externally, but I've since confirmed that it must be turned off. To turn off Personal Web Sharing, launch System Preferences and click the Sharing icon in the Internet & Network group. On the Services tab, ensure that the Personal Web Sharing service is unchecked.

Now move to the Firewall tab. You can, of course, turn off the firewall all together, but that's the easy way out and potentially more dangerous. If you want to be more selective about what is exposed, leave the firewall turned on. Since Personal Web Sharing was disabled on the Services tab, it's automatically disabled on the Firewall tab which appears to close off port 80. It seems the two settings can't be enabled independent of each other, but no worries, there are more ways to skin that cat. In this case, all I really wanted to expose was traffic on port 80. To do so:

  1. Click the New button next to the services list
  2. Select Other in the Port Name drop down list
  3. Enter 80 in the TCP Port Number(s) textbox
  4. Leave the UDP Port Number(s) textbox empty
  5. Enter HTTP (or any other descriptive text) in the Description textbox
  6. Click OK

The MAMP-installed Apache server should now be available to handle web requests initiated by any external machine that has access to the host machine.

tags:
Mac, Apache, mamp
ana gil said:
 
Hi!

First of all, thank you for this post. Since I am not using Personal Web Sharing, I definitely was in need of this solution.

I managed to view the home page of my web page
http://web.host.ip:80/sdesp/index.php
in another computer in the local network, but wasn't able to go further from there. Every link I clicked on redirected to changed the port from 80 to 8888:
http://we/host.ip:8888/sdesp/......

Did you have the same problem? How can I solve this?

Thank you very much!

Ana
 
posted 188 days ago
Add Comment Reply to: this comment OR this thread
 
Rob said:
 
Hey Ana -

I didn't have that problem, but moreover, there's no reason it should happen unless you're specifying the port as 8888 in your site links. Another possibility is that it's specified in either an htaccess file or, just maybe, in your httpd.conf file. Try searching your httpd.conf file for 8888 and see if anything is found.
 
posted 187 days ago
View Replies (1) || Add Comment Reply to: this comment OR this thread
 
.: HIDE REPLIES :.
ana gil said:
 
Thank you for your answer! I did find the
"ServerName localhost:8888" and after changing that, it worked just fine!
Thanks again!!!!!!! :)
 
posted 186 days ago
Add Comment Reply to: this comment OR this thread
 

Search

Rob  Wilkerson