Running a local web server

Continuing the discussion from Can't empty trash, not even with usual tricks:

I run two local web servers on my LAN, both Apache. One is on my Mac and one is on a Linux PC.

The Mac one is primarily a local mirror of my personal web page, back when my ISP provided free personal web hosting. But I also put files there for easy access from the other computers in my home. One of these days, I’ll pay for some actual web hosting and put the files back on-line, but I haven’t gotten around to it for many years already.

The Linux PC one is a clone of a personal web site I used run on my employer’s server, back when I worked for a company that provided personal home page space. That one is primarily a file of bookmarks/links to all kinds of things related to my work - standards documents, useful articles, links to presentations I’ve written, etc.

In both cases, they’re convenient places where I can put files for access from any other computer in my home.

I’ve also considered installing MediaWiki on one of these computers, for use as a place where family members can leave notes and record useful things for each other. But maybe not, since we’ve all got other tools we like to use for this instead.

1 Like

@Shamino Ahh, thanks for telling me. I should have seen that you are indeed a seasoned SW dev, this explains your setup.
I run web servers (for clients) all at a hosting company, many of them, all on RH-Linux. I thought that local Apache days are truly over. But as I now see, there are cases…

‘Home based’ file sharing and similar stuff is all via iCloud, with one notable exception where the person is unable to use anything else but OneDrive.

A good hoster can save you a lot of headache, it has to be small enough to care about individual smaller customers like me, but big enough to offer all the features. I stay away from the brands everybody knows, a point almost worth its own discussion.

Really? Dang, I must have missed that all these years. I’m familiar with the Relocated Items folder being created after a major OS update, and I definitely have to restore my Apache config file afterward from a backup I keep just for this purpose, but I’ve never connected the two events. Are you saying your original httpd.conf file appears in Relocated Items after an update?

I’ve only been manually updating the Apache configuration (/etc/apache2/httpd.conf and /etc/apache2/extra/httpd-userdir.conf) since I got my most recent Mac (purchased with Catalina). Apple’s updates don’t destroy my configuration, but the Relocated Items folder that gets created contains the factory-default contents of these files, which I compare against mine in case anything new got added that I might want/need to integrate.

On my prior Mac, I was running Apple’s, which had a nice GUI for Apache configuration, which I used at that time to configure and manage it.

I -really miss- Server. I still have one older machine that runs Server, eventually I’ll finish moving stuff off that to a newer Mini running nginix for web server. I might need to keep the older machine running for a Java app. (Java sure didn’t live up to its portability promises…)

The nice thing is that Apple includes (and has included since the very first release of MacOS X) the Apache web server. Without, you need to configure it manually (edit config files, etc.), but it works great.

Here are two links I used to help me set it up on my system:

Of course, if you prefer nginx over Apache, that’s a completely different matter.

For what I need nginix is much simpler to configure. And it has a really good reputation for security (in part because it is a much more limited product than apache.)

1 Like

we have, ever so slightly, moved away from the original topic. Maybe @ace wants to split the topic?

I’m however a bit curious: In which scenario does one run your own local Apache or nginx server?

Interesting. Prior to now, Apple’s updates have replaced my httpd.conf file with a new one (since at least Mojave). I believe the existing file was renamed to httpd.conf.bu, but I’m less certain about that. I will have to watch closely when I install Sonoma.

A major release upgrade (e.g. from Big Sur to Ventura) may well be more aggressive with what it does to configuration files, compared with a point upgrade (e.g. from 11.5 to 11.6).

But there should be files in Relocated Items to help you determine what was changed and to help you revert anything you don’t want to keep.

The first two posts in this thread nominally come after the posts I merged in, so keep that in mind while reading…

1 Like

I run an internet-facing web server at home for family pictures/memories. It is hosted on a RaspberryPi running Apache with the http content contained on an HDD. Dynamic DNS is by I dump pictures and files into a folder, then run a Python script to create thumbnails and a draft index file. I edit the index file by hand. It’s nothing fancy, just basic folders and hypertext, but it will still work 50 years from now.

1 Like

That can certainly work. I actually have a Pi on my LAN (acting as my DNS and DHCP servers).

I have deliberately chosen to not make any of my local Servers accessible to the Internet because I’m concerned about security and don’t have the time or desire to make sure everything is patched and firewalled from the rest of my LAN. (Which is why I will pay for hosting if/when I decide to make my site(s) public.)

But I’m glad to hear that it works well for you.

So fast forward one month, and I have installed Sonoma. From what I can tell, the installation process:

  1. Renamed /Users/Shared/Relocated Items to Previously Relocated Items 17 (yeah, there are that many in there)
  2. Created the folder Relocated Items with a few sub-folders, including apache2, which contains an httpd.conf file
  3. Erased the original /etc/apache2/httpd.conf file and installed a new one

So, pretty much as you surmised. And I was wrong: There was no backup of the httpd.conf file created in /etc/apache2 (the thinking being, I guess, that the copy in Relocated Items was your backup).

That looks like what I’ve observed over the years.

Within the Relocated Items is a tree mirroring the paths to the files that changed (e.g. .../private/etc/apache2).

If the installer replaces a file, then your original is placed in Relocated items. This looks like what happened as a part of your Sonoma installation, and is what I would expect from a major OS upgrade.

If the installer doesn’t replace the file, but wants to alert you to the fact that you are using a custom (or maybe just not recommended) configuration, then the working file is left alone and a file is placed in Relocated Items containing the default version of the file. If I remember correctly, it will be the actual filename with _default appended to it (e.g. httpd.conf_default). This is what I’ve observed for minor updates (e.g. 11.3 to 11.4).

in either case, if the files are text (as is the case for the Apache config files), you can compare the live files with the ones in Relocated Items and then make whatever changes you feel are appropriate. Then restart the affected services or reboot in order to activate the changes.