第 17.1 节 Apache
安装
# cd /usr/ports/www/apache24/
# make install clean
或
# pkg install apache24
查看安装后说明
root@ykla:~ # pkg info -D apache24
apache24-2.4.63:
On install:
To run apache www server from startup, add apache24_enable="yes"
in your /etc/rc.conf. Extra options can be found in startup script.
# 要使 Apache WWW 服务器在启动时自动运行,请在 /etc/rc.conf 文件中添加 apache24_enable="yes"。
# 额外的选项可以在启动脚本中找到。
Your hostname must be resolvable using at least 1 mechanism in
/etc/nsswitch.conf typically DNS or /etc/hosts or apache might
have issues starting depending on the modules you are using.
# 您的主机名必须能够通过 /etc/nsswitch.conf 中的至少一种机制解析,通常是 DNS 或 /etc/hosts。
# 否则,Apache 可能在启动时会遇到问题,具体取决于您使用的模块。
- apache24 default build changed from static MPM to modular MPM
- more modules are now enabled per default in the port
- icons and error pages moved from WWWDIR to DATADIR
# - apache24 默认构建从静态 MPM(多处理模块)更改为模块化 MPM。
# - 现在端口中默认启用了更多模块。
# - 图标和错误页面从 WWWDIR 移动到了 DATADIR。
If built with modular MPM and no MPM is activated in
httpd.conf, then mpm_prefork will be activated as default
MPM in etc/apache24/modules.d to keep compatibility with
existing php/perl/python modules!
# 如果使用模块化 MPM 构建并且在 httpd.conf 中没有激活 MPM,那么 mpm_prefork 将作为默认的 MPM 在 etc/apache24/modules.d 中激活,
# 以保持与现有的 PHP/Perl/Python 模块的兼容性!
Please compare the existing httpd.conf with httpd.conf.sample
and merge missing modules/instructions into httpd.conf!
# 请将现有的 httpd.conf 文件与 httpd.conf.sample 文件进行比较,并将缺失的模块/指令合并到 httpd.conf 文件中!
On upgrade:
The default database format was changed from BerkeleyDB 5
(deprecated) from ports to BerkeleyDB 1 from base libc.
# 升级时:
# 默认的数据库格式已从 BerkeleyDB 5(已弃用)从 ports 切换到 base libc 中的 BerkeleyDB 1。
You must rebuild all your (RewriteMap) databases once after
upgrading from 2.4.62 to 2.4.62_1 or later.
# 升级后,您必须重新构建所有的 (RewriteMap) 数据库,特别是在从 2.4.62 升级到 2.4.62_1 或更高版本之后。
启动服务
添加服务开机自启
root@ykla:~ # service apache24 enable
apache24 enabled in /etc/rc.conf
root@ykla:~ # service apache24 start
启动服务(可能需要一分钟):
root@ykla:~ # service apache24 start
Performing sanity check on apache24 configuration:
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using198.18.0.103. Set the 'ServerName' directive globally to suppress this message
Syntax OK
Starting apache24.
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using198.18.0.103. Set the 'ServerName' directive globally to suppress this message
查看状态
root@ykla:~ # service apache24 status
apache24 is running as pid 2068.
按理来说,apache 服务已经启动了,现在可以打开网址 localhost
或其 ip 看一下:
Apache 的配置文件在 /usr/local/etc/apache24/httpd.conf
,示例文件在 /usr/local/etc/apache24/httpd.conf.sample
。网站根目录在 /usr/local/www/apache24/data/
。
最后更新于