【问题标题】:Homebrew Apache directories on MacOS Big SurMacOS Big Sur 上的 Homebrew Apache 目录
【发布时间】:2021-09-20 03:05:02
【问题描述】:

我浏览了所有我能找到的在 Big Sur 上安装和配置 Apache 的教程。在讨论配置文件时,教程总是会指向 /usr/local/etc/httpd/httpd.conf ,需要稍微修改一下。唯一的问题是当我检查该目录时该文件不存在。任何想法?提前感谢您的帮助。

编辑:我按照请求卸载并安装了 httpd,但我仍然没有得到 /usr/local/.自制配置一定有不同的地方。

➜  ~ 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
➜  ~

【问题讨论】:

    标签: apache homebrew macos-big-sur


    【解决方案1】:

    [编辑和更新] 我正在使用 macOS Catalina 10.15.7 / Xcode-select 版本 2373 并通过运行 $ brew install httpd 我可以在 /usr/local/ 下安装 Apache 服务

    您能否通过使用相同的命令并共享所有输出来删除并重新安装它?

    这些是重要的事情:

      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
    

    这是目录列表。

      $ 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
    

    这是我的测试,表明它正在工作。

      $ 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
    

    根据您的输出和 brew 文档,我相信您使用的是 Apple Silicon 是否正确,您能确认一下吗?

    https://docs.brew.sh/Installation

    • 此脚本将 Homebrew 安装到其首选前缀(macOS Intel 为 /usr/local,Apple Silicon 为 /opt/homebrew,Linux 为 /home/linuxbrew/.linuxbrew),因此您在 brew 时不需要 sudo安装。这是一个仔细的脚本;即使您已经在首选前缀中安装了东西,它也可以运行。它会在执行此操作之前准确地告诉您它将做什么。您必须在开始之前确认它会执行的所有操作。

    【讨论】:

    • 我做到了,这就是问题所在:brew reinstall httpd 将 homebrew 放入 /opt/homebrew/opt/httpd。在您链接的教程中,我失败了:tail -f /usr/local/var/log/httpd/error_log tail: /usr/local/var/log/httpd/error_log: 没有这样的文件或目录。配置文件在: > find /opt -name httpd.conf /opt/homebrew/etc/httpd/httpd.conf /opt/homebrew/etc/httpd/original/httpd.conf /opt/homebrew/Cellar/httpd/ 2.4.49/.bottle/etc/httpd/httpd.conf /opt/homebrew/Cellar/httpd/2.4.49/.bottle/etc/httpd/original/httpd.conf 所以显然 /usr/local/etc 没有指向 /op/homebrew/etc.
    • 我添加了 brew 命令输出。还是没有雪茄。
    • 现在很清楚你的 Homebrew 安装在 /opt/homebrew/ 而不是 /usr/local 下,你为什么不试试:tail -f /opt/homebrew/var/log/httpd/access_log Homebrew 文档中提到了路径的差异,你想要解决这个问题并专门移动到 /usr/local 只是为了完全按照教程进行操作,或者您想要实现什么?
    • 我只想把配置文件放在 /usr/local.相反,自制软件正在 /opt/homebrew 中安装 httpd,并且配置也在该目录下。我确实删除了所有内容并重新安装。同样的交易。这不像我没有尝试......
    • 如果您运行的是 macOS Intel 或 Apple Silicon,请查看 Homebrew 文档并确认 -> docs.brew.sh/Installation 此脚本将 Homebrew 安装到其首选前缀(对于 macOS Intel,/usr/local,/opt/homebrew Apple Silicon 和 /home/linuxbrew/.linuxbrew for Linux),这样您在 brew install 时不需要 sudo。
    猜你喜欢
    • 1970-01-01
    • 2021-05-08
    • 2022-01-11
    • 2021-03-29
    • 2021-11-10
    • 1970-01-01
    • 2022-01-09
    • 2021-06-19
    • 2021-08-04
    相关资源
    最近更新 更多