SSHD
问题解决
允许 root 登录
这不是个好主意,可是作为个人试验机器,我喜欢做什么事情都用 root 。和 Linux 不同,需要显示指定 root 能登录,在 /etc/ssh/sshd_config 文件中添 加:
PermitRootLogin yes
重启 sshd :
# /etc/rc.d/sshd restart
HTTP
参考: http://www.freebsd.org/doc/zh_CN/books/handbook/network-apache.html
配置
我的系统上安装的 apache22,配置文件在:
/usr/local/etc/apache22/httpd.conf
- ServerRoot "/usr/local"
这指定了 Apache 安装的顶级目录。 执行文件被放到服务器根目录 (server root) 的 bin 和 sbin 子目录中, 而配置文件则位于 etc/apache。
- ServerAdmin you@your.address
-
这个地址是在服务器发生问题时应发送电子邮件的地址, 它会出现在服务器生成的页面上,例如错误页面。
- ServerName www.example.com
-
ServerName 允许您配置发送回客户端的主机名,如果您的服务器被用户以别的名字访问 (例如, 使用 www 而不是主机本身的真实名字)。
- DocumentRoot "/usr/local/www/data"
-
DocumentRoot: 这个目录是您的文档所在的目录。 默认情况下,所有的请求都会从这个位置去获取, 但也可以通过符号连接和别名指定其它的位置。
在修改配置之前备份 Apache 的配置文件永远是一个好习惯。一旦对初始配置满意了, 就可以开始运行 Apache 了。
运行
| /usr/local/sbin/apachectl start | 启动 |
| /usr/local/sbin/apachectl stop | 停止 |
| /usr/local/sbin/apachectl restart | 重启 |
| /usr/local/sbin/apachectl graceful | 重新加载配置,不中断当前的连接 |
添加到系统启动中
要在系统启动时启动 Apache, 则应在 /etc/rc.conf 中加入:
apache_enable="YES"
或者对于Apache 2.2:
apache22_enable="YES"
如果您希望在系统引导时启动 Apache httpd 程序并指定其它一些选项, 则可以 把下面的行加到 rc.conf:
apache_flags=""
现在 web 服务器就开始运行了, 您可以使用 web 浏览器打开 http://localhost/。 默认显示的 web 页面是 /usr/local/www/data/index.html。
问题解决
Failed to enable the 'httpready' Accept Filter
参考: http://blog.csdn.net/magicbreaker/archive/2008/04/02/2244946.aspx
在FreeBSD下使用ports安装apache22会出现类似的warming:
# /usr/local/sbin/apachectl start httpd: apr_sockaddr_info_get() failed for .domain httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName [Sun Sep 27 20:55:16 2009] [warn] (2)No such file or directory: Failed to enable the 'httpready' Accept Filter
对于 “No such file or directory: Failed to enable the 'httpready' Accept Filter ” 解决方法是:
#kldload accf_http
并将/boot/defaults/loader.conf中,以便下次启动自动装载模块
accf_data_load="YES" accf_http_load="YES" # 改了这一个就可以启动了。
mod_unique_id: unable to find IPv4 address of
参考: http://bbs.chinaunix.net/viewthread.php?tid=938552
# /usr/local/sbin/apachectl start httpd: apr_sockaddr_info_get() failed for .domain httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName # hostname .domain # 我的 hostname 就是 .domain
由于 .domain 是我安装 BSD 随便设置的一个域名,httpd 不能解析,且 httpd 根本没有起来。可以这样:
# echo 127.0.0.1 .domain >> /etc/hosts
现在启动正常了:
# /usr/local/sbin/apachectl restart httpd: Could not reliably determine the server's fully qualified domain name, using .domain for ServerName httpd not running, trying to start
