You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Monterey, view localhost website over local network?

I've set up a localhost server as per these awesome instructions:

Setting up a local web server on macOS 12… - Apple Community

I can view the resources in that directory correctly via a browser on the computer the localhost is set up on but I want to access the webpage from another computer on the same local network.

At the moment I get a "Forbidden" notice.

Is there a simple way to do this?


Posted on Apr 28, 2022 12:21 AM

Reply
Question marked as Top-ranking reply

Posted on Apr 28, 2022 7:51 AM

crewmarker wrote:

I've set up a localhost server as per these awesome instructions:
Setting up a local web server on macOS 12… - Apple Community
I can view the resources in that directory correctly via a browser on the computer the localhost is set up on but I want to access the webpage from another computer on the same local network.
At the moment I get a "Forbidden" notice.
Is there a simple way to do this?

Sure. In the file /etc/apache2/users/<your short user name>.conf


comment out this line:


Require host localhost


and add this line:


Require all granted

Similar questions

5 replies
Question marked as Top-ranking reply

Apr 28, 2022 7:51 AM in response to crewmarker

crewmarker wrote:

I've set up a localhost server as per these awesome instructions:
Setting up a local web server on macOS 12… - Apple Community
I can view the resources in that directory correctly via a browser on the computer the localhost is set up on but I want to access the webpage from another computer on the same local network.
At the moment I get a "Forbidden" notice.
Is there a simple way to do this?

Sure. In the file /etc/apache2/users/<your short user name>.conf


comment out this line:


Require host localhost


and add this line:


Require all granted

Apr 28, 2022 7:56 AM in response to crewmarker

How exactly are you trying to access the server?


In the local mac, are you able to type


http://localhost


and see the web page?


In the absence of a DNS name, or an entry in the /etc/hosts file, in another machine you are going to have to type the IP address of the server.


In the server, go to System Preferences->Network and make a note of the IP address - say, 192.168.1.37


Then in another machine type


http://192.168.1.37


and show work.

If not, give us more detail about how you are accessing the site, both locally and on another machine.


Apr 28, 2022 8:23 AM in response to crewmarker

One other IMPORTANT detail: what port are you running your server on?


If are using software like MAMP to create your server, it typically uses a port number like 8888.

This port will be closed by default, and that is perhaps why you can't access it.

If the server is run at the default port 80, there should be no difficulty.

I just tested and had no trouble using my iPhone to access the server running on my mac.

However, running a server at 8888 did not work.

You'd have to mess with the firewall to open the needed port(s).

Monterey, view localhost website over local network?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.