mac安装hhhpd

一、非macos系统自带的httpd安装

采用homebrew安装

brew install httpd

 

 

安装完成后的配置如下:

==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/httpd-2.4.51.arm64_big_sur.bottle.tar.gz

Already downloaded: /Users/huangdan07/Library/Caches/Homebrew/downloads/6bdde48eee3bcc27f1997226ea9626280388f3892ca9f8d03f91ef8f74de2c27--httpd-2.4.51.arm64_big_sur.bottle.tar.gz

==> Reinstalling httpd

==> Pouring httpd-2.4.51.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 start httpd:

  sudo brew services stop httpd

  sudo 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.51: 1,660 files, 32.0MB

 

httpd -t

httpd -M

 

二、macos系统自带的httpd

/etc/apache2/httpd.conf

DocumentRoot is /Library/WebServer/Documents

 

 

三、httpd链接php配置

在/opt/homebrew/etc/httpd/httpd.conf中加入如下配置,配置完成后,http://localhost:8080/index.php链接,展示hello world(非原始代码)

#加载PHP
LoadModule php7_module /usr/libexec/apache2/libphp7.so
#加载PHP配置文件
PHPIniDir /opt/homebrew/etc/php/8.0/php.ini
#分配给PHP
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
posted @   larybird  阅读(62)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 记一次.NET内存居高不下排查解决与启示
点击右上角即可分享
微信分享提示