第 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.
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.
- 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
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!
Please compare the existing httpd.conf with httpd.conf.sample
and merge missing modules/instructions into httpd.conf!
On upgrade:
The default database format was changed from BerkeleyDB 5
(deprecated) from ports to BerkeleyDB 1 from base libc.
You must rebuild all your (RewriteMap) databases once after
upgrading from 2.4.62 to 2.4.62_1 or later.
启动服务
添加服务开机自启
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/
。
最后更新于