`

FreeBSD8.2 手动安装Apache

 
阅读更多

 

1, 下载Apache2.2 http server安装包。

最好选择中国的镜像下载。我测试了我的最近镜像为北京交大的镜像。所以我使用了下面的URL下载。因为bz2格式的源文件比gz小,所以我选择下bz2格式。


 

2,安装Apache2.2

参考install.html去安装。因为我们已经完成了Download步骤,所以我们只需要从Extract开始。到达安装包所在的目录使用tar xjf httpd-2.0.64.tar.bz2解压。进入解压后的安装目录。


 

然后就是Configure的时候需要把PREFIX换成你想要安装Apache2.2的目录.

添加with-perl是为了编译apxs,apxs在安装PHP时将会用到。

我使用了默认的目录。命令如下:

./configure prefix=/usr/local/apache2 with-perl

仿照上面步骤编译和安装。

客户化的那步可以不做。

测试。

打开浏览器输入http://127.0.0.1,出现it works.表示安装成功。

 

 

问题解决:

1[warn] (2)No such file or directory: Failed to enable the 'httpready' Accept Filter.

问题:没有装载accf_http 模块。

解决方案:

On FreeBSD you must load the accf_module before you can start apache, otherwise you are sure to get an httpready error. To load the module use kldload

1)

# kldload accf_http

 

If it loaded successfully then it will not give any errors or output. To have it load on boot add this to your /boot/loader.conf file

2)

accf_http_load="YES"

 

2,解决HostName问题。

[root@linux http]# ./apachectl start
httpd: apr_sockaddr_info_get() failed for linux
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

问题是:

apacheconf目录下的配置文件httpd.conf中关于服务器名字设置和机器名与域名不一致。

比如机器名字为fbsd,域名为unix.那么找到ServerName.

修改服务器名为ServerName www.fbsd.unix.com:80

保存并重启Apache.

 

3,解决You dont have permission to access /index.html on this server.

输入http://127.0.0.1或者http://www.主机名.com显示以上提示。

问题原因:index.html是用root用户建的文件,apache权限不够。

解决方案:chmod 775 index.html.

 

4,启动Apache遇到Invalid command \xc2\xa0, perhaps misspelled or defined by a module not included in the server configuration.

问题原因:从网站上粘贴代码近httpd.conf,不被识别,所以建议手写输入代码到http.conf,而不是复制粘贴。

解决方案:去掉一些看不见的字符或者删除原来那些粘贴代码重新手写输入。

 

5,碰到Invalid command 'RewriteEngine'

问题原因:没有启动mod_ RewriteEngine

解决方案如果安装的是源代码Apache,那么去安装包查看是不是没有enable。例子如下:

cd /tmp/httpd NN

./configure

如果mod_rewrite enable is no。那么:

./configure enable-rewrite

make

make install

 

  • 大小: 74.4 KB
  • 大小: 60.5 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics