FreeBSD:Apache

来自WHY42
pkg install apache24

sysrc apache24_enable="yes"
# /etc/rc.conf
# apache24_enable="yes"

service apache24 start
# /usr/local/www/apache24/data/

安装 php:

pkg install php72 mod_php72 php72-ctype php72-mbstring php72-json php72-iconv php72-fileinfo php72-xml php72-session php72-dom php72-hash php72-gd php72-xmlreader php72-xmlwriter php72-openssl

在/usr/local/etc/apache24/modules.d中新建配置文件:010_mod_php.conf,注意命名。

# Files are automatically included if the name
# begins with a three digit number followed by '_'
# and ending in '.conf' e.g. '080_mod_php.conf'
<FilesMatch "\.php$">
    SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
</FilesMatch>

还需要在 httpd.conf中打开 mod_rewrite.