Trouble sorting out Apache on the Post-Server Mac

Yes, I know, Apple no longer supports Server for doing anything more than a little profile and device management, and some XSan while nobody's looking. (Who even uses that? Wait, no, wrong question, we're focusing on Apache today.) But vestiges of the old Server app still linger under the hood, and other parts have been brusquely torn out, between them leaving rough edges on the error logs and the fact that some stuff just isn't working as it should.


Apache is still technically running. I can go to http://terrilith.local and call up the index page of the current (degenerate) Server app, though it's come unhooked from PHP; I have an install of dokuwiki that I have crammed a lot of notes into, and all I get is a single page of php script instead of the stuff I need. (I have another way to browse those pages, but it's suboptimal to put it mildly.)


Then I start poking around under the hood, and things get weird.


Through terminal I enter

which httpd

...and it tells me

/usr/sbin/httpd

Likewise if I ask terminal

which apachectl

...it tells me

/usr/sbin/apachectl


All well and good. And if I enter

httpd -V

(with the capital V, so it gives me the details of its construction) it tells me

Server version: Apache/2.4.34 (Unix)

Server built: Aug 17 2018 16:29:43

Server's Module Magic Number: 20120211:79

Server loaded: APR 1.5.2, APR-UTIL 1.5.4

Compiled using: APR 1.5.2, APR-UTIL 1.5.4

Architecture: 64-bit

Server MPM: prefork

threaded: no

forked: yes (variable process count)

Server compiled with....

-D APR_HAS_SENDFILE

-D APR_HAS_MMAP

-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)

-D APR_USE_FLOCK_SERIALIZE

-D APR_USE_PTHREAD_SERIALIZE

-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT

-D APR_HAS_OTHER_CHILD

-D AP_HAVE_RELIABLE_PIPED_LOGS

-D DYNAMIC_MODULE_LIMIT=256

-D HTTPD_ROOT="/usr"

-D SUEXEC_BIN="/usr/bin/suexec"

-D DEFAULT_PIDLOG="/private/var/run/httpd.pid"

-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"

-D DEFAULT_ERRORLOG="logs/error_log"

-D AP_TYPES_CONFIG_FILE="/private/etc/apache2/mime.types"

-D SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf"

Good stuff, that. It tells me where the configuration file for the web server is.


Or does it??


Looking into the file /private/etc/apache2/httpd.conf reveals the main directive

DocumentRoot "/Library/WebServer/Documents"

...meaning that's where the web server should be pulling the pages it shows. But when I call up the error log after pulling up a page it can't find (say, the link to the wiki install I just removed for this purpose), I get

File does not exist: /Library/Server/Web/Data/Sites/Default/doku/

That's the folder the Server stored those pages in when Server was still providing the wrapper for the Apache web service.


Additionally, if in the terminal I try

httpd -t

(to check the syntax of the config files), I get the notifications:

[Sun Nov 18 10:07:17.291468 2018] [core:warn] [pid 83214] AH00111: Config variable ${WFS_SERVER_ADDR} is not defined

[Sun Nov 18 10:07:17.291536 2018] [core:warn] [pid 83214] AH00111: Config variable ${WFS_SERVER_PORT} is not defined

[Sun Nov 18 10:07:17.291544 2018] [core:warn] [pid 83214] AH00111: Config variable ${WFS_SERVER_ADDR} is not defined

[Sun Nov 18 10:07:17.291547 2018] [core:warn] [pid 83214] AH00111: Config variable ${WFS_SERVER_PORT} is not defined

[Sun Nov 18 10:07:17.296866 2018] [core:warn] [pid 83214] AH00111: Config variable ${WFS_SERVER_NAME} is not defined

[Sun Nov 18 10:07:17.296881 2018] [core:warn] [pid 83214] AH00111: Config variable ${WFS_SERVER_PORT} is not defined

[Sun Nov 18 10:07:17.297756 2018] [core:warn] [pid 83214] AH00111: Config variable ${WFS_ACCESS_GROUP} is not defined

[Sun Nov 18 10:07:17.297771 2018] [core:warn] [pid 83214] AH00111: Config variable ${WFS_SERVER_NAME} is not defined

AH00526: Syntax error on line 25 of /private/etc/apache2/other/httpd_webdavsharing.conf:

Port must be specified


And even wilder, if I try

sudo apachectl stop

it doesn't anything's wrong, but it doesn't say anything's right either since I can still pull up that useless MacOS Server landing page. Frankly, I'm not sure if that's "irony" or "adding insult to injury."


If I had to interpret what I've seen so far, it looks like there are two Apache installs on this computer, and the one I'm trying to configure has nothing to do with what's actually serving up pages.


Can anyone suggest how to untangle this mess short of deleting the Server app which I no longer need and reinstalling the OS?

MacBook Pro TouchBar and Touch ID, macOS Mojave (10.14.1), Terrilith

Posted on Nov 18, 2018 7:13 AM

Reply

Similar questions

11 replies

Nov 20, 2018 8:04 AM in response to Territan

A little gentle poking around in the script and Trying Dumb Stuff™ has turned up a new wrinkle:


My web server is working, it turns out.


However, it's on port 8080 instead of 80, because...

# Change this to Listen on specific IP addresses as shown below to

# prevent Apache from glomming onto all bound IP addresses.

#

#Listen 12.34.56.78:80

<IfDefine SERVER_APP_HAS_DEFAULT_PORTS>

Listen 8080

</IfDefine>

<IfDefine !SERVER_APP_HAS_DEFAULT_PORTS>

Listen 80

</IfDefine>


The value was defined, but not used in any meaningful way after I deleted the appThanks again, Server.


My next thrill is going to be upgrading the PHP...

Nov 18, 2018 10:25 AM in response to Territan

Riiiiiiight...


Deleted Server, because near as I could figure its Apache install was contained in the application bundle, and otherwise it was doing nothing for me in a non-enterprise environment anyway. Then rebooted to make sure that service was properly shut down. That shut down the "Server" Apache, so that's dealt with.


Then, "just following the instructions," I did a sudo apachectl start and got ...nothing. Following that up with an apachectl configtest turned up the same thing when I executed httpd -t above: warnings that the environment variables WFS_SERVER_ADDR, WFS_SERVER_PORT, WFS_SERVER_NAME, and WFS_ACCESS_GROUP had not been defined, and that the port must be specified for WebDav sharing. There is no obvious place to set those environment variables or what their values should be, and the instructions offer no support in those areas. That appears to be the next major hurdle.


Please include the word "similidon" in your next post to assure me that you're actually reading these things.

Nov 18, 2018 10:59 AM in response to Territan

similidon


Hopefully you will be kind enough to provide the password to get out too...


I think your explanation sounds pretty good. I never used Server myself. Well, I tried it once. I tried to setup a local e-mail server and within a few minutes found myself deep into DNS. I found it was easier to install an open-source e-mail server instead.


It does sound like Server had its own binaries, but may have modified your system config files. The Mac has an odd relationship with config files. For the main Apache file at least, it seems to overwrite it on each OS update. But other config files, especially ones that could have security considerations, will never again be automatically updated if you make any changes.


I recently published an updated User Tip on how to setup Apache on Mojave: Setting up a local web server on macOS 10.14 “Mojave”


However, it looks like your setup has already been pretty scrambled by Server. My instructions above assume a relatively pristine operating system. Maybe install Mojave in a VM and copy the config files.

Nov 18, 2018 3:14 PM in response to Territan

Do I need Webdav? Not so much; ultimately, that was another vestige of Server to facilitate adding pages to the wiki. The wiki that no longer exists. Yeeeeeah...


The next step was removing the webdav reference from the httpd.conf. But all dav references were commented already. So here's a fun fact: There's a directive at the very end of httpd.conf that includes /etc/apache2/other/*.conf, and that's where the webdav sharing conf file is located — and loaded. I moved it into its own other_disabled folder. That error went away.


The problem after that was the ServerName directive. That was easily enough fixed by uncommenting and setting it.


Finally, httpd -t (and apachectl configtest) returned "Syntax OK". I was ready. I entered sudo apachectl start...


...and the only thing I got out of that was the traditional "Safari can't connect to server" message. It appears I'm still dead in the httpd. From here, I'm not sure how to debug.

Nov 18, 2018 2:20 PM in response to Territan

Territan wrote:


Now, what's the best practice for getting those values into Apache? Just cut them into httpd.conf? Write an include for better control?

Do you need those services? If so, then you are going to have to figure out how to properly configure them from scratch - and then figure out how to configure them after having had Server running. If you don't need them, then just comment out those dav modules in the config file. They are commented out by default.

Nov 18, 2018 9:50 AM in response to BobTheFisherman

Interestingly, those instructions are hauntingly similar to instructions I had pulled down from another link, https://www.dyclassroom.com/howto-mac/how-to-install-apache-mysql-php-on-macos-m ojave-10-14 . Both guides also assume I'm starting from about the same place, and don't have a working Apache install yet.


I'm coming at it through the old Server app, which provided an Apache install of sorts, and which continues serving up pages even after I execute sudo apachectl stop. So I apparently have two Apache installs, one of which is doing not quite enough and the other of which I can control and isn't doing anything. I need either to seize control of the Server's apache server, or kick it out of the way in favor of Mojave's. Those guides, while thoughtful, do nothing for me now.

Nov 18, 2018 11:30 AM in response to Territan

Sorry you are having issues. I can assure you that I have many instances of Apache running. Apache and its associated files do move depending on OS version but the instructions I pointed to are specifically for Mojave. If you had another version operating system installed along with Apache served web sites then things may have changed. You'll have to determine where your config and web root files were/are and appropriately move things around based on the instructions for Mojave.

Nov 18, 2018 12:40 PM in response to Territan

In its time, Server was an okay thing for some services, like a very convenient web server. Its own wiki was also very easy to use, so I experimented with it alongside doku to determine which I preferred, but I learned of its shortcomings when I had a disk event and couldn't restore it from backups because beside using its own install of Apache, it had its own install of Postgres. Whoops. Meanwhile, dokuwiki stored its pages in plaintext, so that choice was obvious.


But back to the problem at hand:


The error I'd been getting:

  • AH00526: Syntax error on line 25 of /private/etc/apache2/other/httpd_webdavsharing.conf:
  • Port must be specified

...sure looked like it had something to do with Webdav sharing. Especially since that line 25 reads:

Listen ${WFS_SERVER_ADDR}:${WFS_SERVER_PORT} ${_WFS_PROTO}

...which contains two of my undefined variables.


A bit more research turned up the command line wfsctl — The Webdav File Sharing control utility, which is active.


And entering the command:

sudo wfsctl diagnose

...turned up a few interesting references, not the least of which is the file /etc/apache2/env.plist...

...which contains convenient values for WFS_SERVER_ADDR (127.0.0.1), WFS_SERVER_PORT (81), WFS_SERVER_NAME (terrilith.local), and WFS_ACCESS_GROUP (everyone). But because it's in a .plist and not a .conf file, I don't think the Apache httpd.conf knows to look for it. I think here again, Server organized for itself and screwed me.


Now, what's the best practice for getting those values into Apache? Just cut them into httpd.conf? Write an include for better control?

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.

Trouble sorting out Apache on the Post-Server Mac

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