使用brew安装的apache的配置
总结一下
为了方便开发使用,我们将配置在macOS使用brew安装的apache httpd。
通过访问 http://localhost/ ,可以访问到 ~/Sites 目录下的文件,这些文件可以通过用户权限进行编辑。
编辑httpd.conf
请编辑 /usr/local/etc/httpd/httpd.conf 文件。您可以搜索每个词语以找到相应的位置并进行更改。
端口更改
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
Listen 80
网站根目录
更改DocumentRoot和其后的Directory目录。
(将其更改为以ls -d ~/Sites显示的目录)
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/Users/<user>/Sites"
<Directory "/Users/<user>/Sites">
请将中的AllowOverride更改为all。
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All
模块重写
删除#符号并取消注释。
LoadModule rewrite_module lib/httpd/modules/mod_rewrite.so
用户及群组
更改用户和组名。
这样,用户权限可以编辑web公开文件。
User <user>
Group staff
服务器名称
将服务器名称更改为本地主机。
ServerName localhost
以上是设置完成。
确认
让我们重新启动 Apache,然后在 http://localhost/ 上进行确认。
sudo apachectl -k restart
打开以下的网页时,会出现:1

相关
- macOS MojaveでLiip PHPのインストール
顺便提一下,iWeb在2011年已经停止开发了…