Mac OS X Mojave。
我正在按照https://www.dionysopoulos.me/custom-apache-and-php-server-on-macos-the-definitive-2019-edition/上的说明操作
在“安装MySQL”之前就到了这一步。
localhost使用Apache默认文件"It Works!“。
我试图更改index.html文件以添加一个星号(在“It”之前)。仍然使用默认设置。
我尝试了http://localhost/?2来强制不缓存。仍在使用默认设置。
我将本地更改回原来的位置/usr/ httpd.conf /var/www,并将更改后的index.html文件放在那里。还是失败了。
我还尝试更改仍然使用默认设置的/usr/local/Cellar/httpd/2.4.41_1/.bottle/var/www/index.html。
我如何找出Apache真正的服务来源?
发布于 2021-05-27 01:00:04
确保您为您的安装更改了正确的文件。您可以像这样检查当前的配置:
brew info httpd上面的代码应该会给你提供安装公式的路径,还应该会向你展示DocumentRoot,例如我的例子:
httpd: stable 2.4.46 (bottled)
Apache HTTP server
https://httpd.apache.org/
/usr/local/Cellar/httpd/2.4.46_2 (1,657 files, 31.4MB) *
Poured from bottle on 2021-02-12 at 06:57:59
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/httpd.rb
License: Apache-2.0
==> Dependencies
Required: apr ✔, apr-util ✔, brotli ✔, nghttp2 ✔, openssl@1.1 ✔, pcre ✔
==> Caveats
DocumentRoot is /usr/local/var/www.如果以上方法不起作用,您也可以使用httpd包中的apachectl来获取DocumentRoot:
cd `brew --prefix httpd`/bin
apachectl -D DUMP_RUN_CFG它会给你类似这样的结果:
ServerRoot: "/usr/local/opt/httpd"
Main DocumentRoot: "/usr/local/var/www"
Main ErrorLog: "/usr/local/var/log/httpd/error_log"
Mutex rewrite-map: using_defaults
Mutex default: dir="/usr/local/var/run/httpd/" mechanism=default
Mutex mpm-accept: using_defaults
PidFile: "/usr/local/var/run/httpd/httpd.pid"
Define: DUMP_RUN_CFG
User: name="_www" id=70 not_used
Group: name="_www" id=70 not_used您还可以使用以下命令显示当前的虚拟主机配置:
apachectl -D DUMP_VHOSTShttps://stackoverflow.com/questions/61024468
复制相似问题