Mac 安装Apache http 服务器

安装

  • brew install httpd
| ~ @ micodeMacBook-Pro (micocube)
| => brew install httpd
==> Downloading https://homebrew.bintray.com/bottles/httpd-2.4.29_1.high_sierra.
Already downloaded: /Users/micocube/Library/Caches/Homebrew/httpd-2.4.29_1.high_sierra.bottle.tar.gz
==> Pouring httpd-2.4.29_1.high_sierra.bottle.tar.gz
==> Caveats
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 have launchd start httpd now and restart at login:
  brew services start httpd
Or, if you don't want/need a background service you can just run:
  apachectl start
==> Summary
  /usr/local/Cellar/httpd/2.4.29_1: 1,625 files, 26MB

配置

  • 注意安装时的输出信息
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 have launchd start httpd now and restart at login:
  brew services start httpd
Or, if you don't want/need a background service you can just run:
  apachectl start

默认的工作路径是/usr/local/var/www,http配置文件在/usr/local/etc/httpd/httpd.conf向外暴露端口8080,https配置文件在/usr/local/etc/httpd/extra/httpd-ssl.conf向外暴露8443
如果需要在系统重启用户登陆的时候就启动httpd,可以执行brew services start httpd,如果你不想在后台执行httpd,可以执行apachectl start

你可能感兴趣的:(Mac 安装Apache http 服务器)