JMan
JMan

Reputation: 1805

How do I make my local webserver accessible to others on my network?

I've got a MacBook running MAMP.

I want others on my team (who are on the same network) to be able to access my local webserver so they can test their client code against my RESTful API's on my server.

We have an Apple Time Capsule/Airport router.

Firewall is turned off on my Mac.

How do I do this? Thanks.

Upvotes: 3

Views: 11165

Answers (4)

LanreSmith
LanreSmith

Reputation: 161

For those who will land on this page in future and want to access their MAMP server by accessible to others on their network (by IP), add this as the very first <VirtualHost *:80> either with the default MacOS Apache server or with MAMP (for MAMP, put it after NameVirtualHost *:80):

<VirtualHost *:80>
    DocumentRoot /path/to/web/root
</VirtualHost>

(where /path/to/web/root = /Applications/MAMP/htdocs for MAMP, & = /Library/WebServer/Documents for the default MacOS Apache server)

Upvotes: 0

JMan
JMan

Reputation: 1805

Check all Apache configuration files (httpd.conf and .htaccess) to check for URL rewrites.

Turns out that my .htaccess file in my root was doing a rewrite to "localhost".

Upvotes: 2

Kevin
Kevin

Reputation: 56089

  1. If you have a firewall, make sure it's configured to allow connections on the appropriate port (usually 80, but with a local server it can be different).
  2. Make sure the server is properly configured to accept connections from remote hosts.
  3. Make sure your company's routers allow internal connections on the appropriate ports.

Upvotes: 0

stu
stu

Reputation: 8805

Well first see if you can connect to it yourself. From a shell try telnet localhost 80 and see if it answers. If not, it's not even listening, need to set that up first.

If that works, try telnetting from other machines on your network to yours (telnet yourmachinesiporname 80) and see if they have connectivity.

You might find your company's firewall blocks things like port 80 so you can't do things like that.

Upvotes: 0

Related Questions