Mac OS Sonoma Default Web Server Directory Location

Trying to local where exactly the non-user-specific web directory is on Sonoma.


If I go to http://localhost/ I get a page that says "It Works!"...


If I go to http://localhost/index.html.en I get a page I added (which says something different of course).


I know the local page I made is at /Library/WebServer/Documents


But where in the heck is the page located for the first URL that doesn't specify the specific file?

MacBook Pro 14″

Posted on Nov 29, 2023 2:36 PM

Reply
8 replies

Nov 29, 2023 3:01 PM in response to MadMacks

MadMacks wrote:

Trying to local where exactly the non-user-specific web directory is on Sonoma.

If I go to http://localhost/ I get a page that says "It Works!"...

If I go to http://localhost/index.html.en I get a page I added (which says something different of course).

I know the local page I made is at /Library/WebServer/Documents

But where in the heck is the page located for the first URL that doesn't specify the specific file?

This very good article by a user is worth reading.

Setting up a local web server on a Mac - Apple Community

and specifically:

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



Nov 29, 2023 3:04 PM in response to BobTheFisherman

That is not a helpful document for my question. I have set up various Apache servers on a variety of macs or linux boxes. In general terms I understand how that gets done. What I don't understand (and I didn't see anything in that linked article, which does NOT apply to Sonoma) is how things changed in Sonoma. I've looked at the Apache config file and don't see anything in there that seems to address my question. So, I'm obviously not a "knowledgeable" as I'd hoped....cause it's a mystery as to where Apache is loading the page from. There is no index.html file in /Library/WebServer/Documents, which is where I would expect it to be located...

Nov 29, 2023 3:30 PM in response to Barney-15E

Nice.


As I said, not as knowledgeable as I'd hoped...


So, I agree, the default location should be /Library/WebServer/Documents...


In that directory, I had exactly one file... index.html.en


That file was updated, by me, to say something like "It Works, Really..."


When I go to "localhost" via Safari The result I get is "It Works!" sans the "Really..." part, just as you show.


When I go to "localhost/index.html.en" I get "It Works, Really..."


So the part that was/is not clear is, if I don't specify a specific page Apache is apparently loading (or generating) a page (should be index.html by default) and displaying "It Works!"


That implies i've done something over the years on my specific installation that is trigger some script, or some other default location, or I'm simply going senile...



Nov 29, 2023 4:11 PM in response to MadMacks

So, here's what I see as I test things.


In /Library/WebServer/Documents...


If you have no "index" files in the directory you get "You don't have permission to access...."


If you have one file called index.html.en you get that file loaded.


If you have one file called index.html you get that file loaded.


If you have two files called index.html.en and index.html you get index.html file loaded.


I assume I was dealing with the browser cache and/or the Apache cache once I started playing around.


Here's the previously unmentioned part of the puzzle... I use StarLink as my ISP. They use CGNAT on their system so accessing local devices with port mapping is not really doable with out a LOT of configuration. But, they do support (more or less unofficially at this point) IPv6 addressing.


What I originally did was to past into the Safari browser the IPv6 address for my local MacBook to verify that I could in fact reach internal devices using IPv6. And happily, that appears to work just fine and I got the "It works!" page displayed.


(Yes, I know that's internal to my LAN and router, and I will test it from "outside" later to validate the StarLink routes, but at least the IPv6 addressing works)...


Then, just to verify I looked at my local file (/Library/WebServer/Documents/index.html.en) and the message in that file was not "It works!" but rather "It still works! Really no kidding...".


That made me scratch my head and wonder where the "It works!" was coming from. A different machine maybe?


I was actually trying to validate the IPv6 addressing to see if it works....which it does...but I probably received a cached version of the old original page...


As of now, I'm pretty sure the IPv6 urls are working and will load thru StarLink (which is a cool and simple way to access local resources without DDNS or Static IPs and port mapping changes)...and that I was simply dealing with initial cache issues in the browser (or Apache) associated with the first time usage of IPv6 vs IPv4. At least that's my assumption...and I'm moving on to other things...


Thx to those that replied...sometimes just talking things thru helps force a different thought process....



This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Mac OS Sonoma Default Web Server Directory Location

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