Homebrew Apache directories on MacOS Big Sur

Viewed 1088

I went thru any tutorial I could find to install and configure Apache on Big Sur. Invariably, the tutorial when discussing the config files will point to /usr/local/etc/httpd/httpd.conf that needs to be massaged a bit. The only trouble is that the file doesn't exist when I check that dir. Any idea? Thanks for your help in advance.

EDIT: I did an uninstall and install of httpd per requested and I still don't get the /usr/local/. There must be something different the homebrew configuration.

➜  ~ brew uninstall httpd          
Uninstalling /opt/homebrew/Cellar/httpd/2.4.49... (1,660 files, 31.9MB)
➜  ~ brew install httpd            
==> Downloading https://ghcr.io/v2/homebrew/core/httpd/manifests/2.4.49
Already downloaded: /Users/johnny/Library/Caches/Homebrew/downloads/6c60d66c3915be5c993e144a743960b9e6be26e557efeeb6c61f530c79ffed34--httpd-2.4.49.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/httpd/blobs/sha256:e6ebcb4a1307
Already downloaded: /Users/johnny/Library/Caches/Homebrew/downloads/8506f199d5d7def536481d6fa87aa94c25201b57072d032e97edb8ce78fa86a3--httpd--2.4.49.arm64_big_sur.bottle.tar.gz
==> Pouring httpd--2.4.49.arm64_big_sur.bottle.tar.gz
==> Caveats
DocumentRoot is /opt/homebrew/var/www.

The default ports have been set in /opt/homebrew/etc/httpd/httpd.conf to 8080 and in
/opt/homebrew/etc/httpd/extra/httpd-ssl.conf to 8443 so that httpd can run without sudo.

To restart httpd after an upgrade:
  brew services restart httpd
Or, if you don't want/need a background service you can just run:
  /opt/homebrew/opt/httpd/bin/httpd -D FOREGROUND
==> Summary
  /opt/homebrew/Cellar/httpd/2.4.49: 1,660 files, 31.9MB
➜  ~
1 Answers

[Edited and updated] I am using macOS Catalina 10.15.7 / Xcode-select version 2373 and by running $ brew install httpd I can install the Apache service under /usr/local/

Can you please remove and install it again by using the same command and sharing all the output?

These are the important things:

  DocumentRoot is /usr/local/var/www.

  The default ports have been set in /usr/local/etc/httpd/httpd.conf to 8080 and in
  /usr/local/etc/httpd/extra/httpd-ssl.conf to 8443 so that httpd can run without sudo.

  To start httpd:
    brew services start httpd
  Or, if you don't want/need a background service you can just run:
    /usr/local/opt/httpd/bin/httpd -D FOREGROUND

This is the list of directories.

  $ ls -lrt /usr/local/etc/httpd
    total 200
    drwxr-xr-x  14 user  admin    448 Sep 22 23:35 extra
    -rw-r--r--   1 user  admin  21222 Sep 22 23:35 httpd.conf
    -rw-r--r--   1 user  admin  13064 Sep 22 23:35 magic
    -rw-r--r--   1 user  admin  60847 Sep 22 23:35 mime.types
    drwxr-xr-x   4 user  admin    128 Sep 22 23:35 original

And this is my test showing it is working.

  $ curl localhost:8080
    <html><body><h1>It works!</h1></body></html>

  $ tail -f /usr/local//var/log/httpd/access_log
    ::1 - - [22/Sep/2021:23:39:35 -0500] "GET / HTTP/1.1" 200 45

Based on your output and the brew documentation I believe you are using Apple Silicon is that correct, can you confirm?

https://docs.brew.sh/Installation

  • This script installs Homebrew to its preferred prefix (/usr/local for macOS Intel, /opt/homebrew for Apple Silicon, and /home/linuxbrew/.linuxbrew for Linux) so that you don’t need sudo when you brew install. It is a careful script; it can be run even if you have stuff installed in the preferred prefix already. It tells you exactly what it will do before it does it too. You have to confirm everything it will do before it starts.
Related