FreeBSD 7.0-RELEASE-i386

# cd /usr/ports/www/apache22 && make install clean
# cd /usr/ports/www/awstats && make install clean 安装awstats的过程
# cd /usr/ports/sysutils/cronolog && make install clean

# ee /usr/local/etc/apache22/httpd.conf

Line 143: Set Administrator’s email address
Line 152: Uncomment, set machine.name.com for the ServerName
Line 205: Options All,AllowOverride All (.htaccess)
Line 323: For cgi-bin, Options FollowSymLinks ExecCGI
配置cronolog:
Line236: ErrorLog “|/usr/local/sbin/cronolog /var/log/apache/www.mysite.com/%Y%m/httpd-error_%Y%m%d.log”
Line271: CustomLog “|/usr/local/sbin/cronolog /var/log/apache/www.mysite.com/%Y%m/httpd-access_%Y%m%d.log” combined
# mkdir -m 777 /var/log/apache
# mkdir -m 777 /var/log/apache/www.mysite.com

# echo ‘apache22_enable=”YES”‘ >> /etc/rc.conf
# echo ‘apache22ssl_enable=”YES”‘ >> /etc/rc.conf

# apachectl configtest
# apachectl start

安装过程错误解决:
先安装Xorg和KDE后再安装Apache22,可能会出现安装错误提示:

===> Installing for apache-2.2.9

===> apache-2.2.9 conflicts with installed package(s):
apr-db42-1.2.8_2

They install files into the same place.
Please remove them first with pkg_delete(1).
*** Error code 1

Stop in /usr/ports/www/apache22.
*** Error code 1

Stop in /usr/ports/www/apache22.

解决方法如下:

# cd /usr/ports/www/apache22
# make config
选择 APR_FROM_PORTS (第一个)
# make install clean

启动错误解决:
No such file or directory: Failed to enable the ‘httpready’ Accept Filter

# echo ‘accf_data_load=”YES”‘ >> /etc/rc.conf
# echo ‘accf_http_load=”YES”‘ >> /etc/rc.conf

mod_unique_id: unable to find IPv4 address of “#########” on Failed

关闭mod_unique_id.so

#LoadModule unique_id_module libexec/apache22/mod_unique_id.so

虚拟主机
# ee /usr/local/etc/apache22/extra/httpd-vhosts.conf

NameVirtualHost *:80

<virtualhost *:80>
ServerAdmin webmaster@mywebsite.org
DocumentRoot “/usr/local/www/apache22/data”
ServerName mywebsite.org
ErrorLog “|/usr/local/sbin/cronolog /var/log/apache/mywebsite.org/%Y%m/httpd-error_%Y%m%d.log”
CustomLog “|/usr/local/sbin/cronolog /var/log/apache/mywebsite.org/%Y%m/httpd-access_%Y%m%d.log” combined
Redirect 301 / http://www.mywebsite.com/
</virtualhost>

<virtualhost *:80>
ServerAdmin webmaster@mywebsite.com
DocumentRoot “/usr/local/www/apache22/data/mywebsite.com”
ServerName www.mywebsite.com
ServerAlias *.mywebsite.com
#ErrorLog “/var/log/dummy-host.example.com-error_log”
#CustomLog “/var/log/dummy-host.example.com-access_log” common
ErrorLog “|/usr/local/sbin/cronolog /var/log/apache/mywebsite.com/%Y%m/httpd-error_%Y%m%d.log”
CustomLog “|/usr/local/sbin/cronolog /var/log/apache/mywebsite.com/%Y%m/httpd-access_%Y%m%d.log” combined
</virtualhost>


免费在线记账服务,个人理财好帮手,小型企业财务管理工具。
http://www.keepaccounts.com/

3 Comments

  • Leo

    請問一下我安裝FreeBSD8.0後用packages安裝apache-2.2.13後依照您的方式設定後,當我從新啟動FreeBSD後,還是出現
    /etc/rc: WARNING: failed to start apache22
    然後再登入系統後啟動apache22,/usr/local/sbin/apachectl start
    還是會出現
    [warn] (2)No such file or directory: Failed to enable the ‘httpready’ Accept Filter
    但是我也依照您的方法加入以下兩筆記錄後還是一樣。
    # echo ‘accf_data_load=”YES”‘ >> /etc/rc.conf
    # echo ‘accf_http_load=”YES”‘ >> /etc/rc.conf

    所以,請您可否給我一些建議和方向,謝謝!

  • 王炜

    有没有关闭mod_unique_id.so?

    mod_unique_id: unable to find IPv4 address of “#########” on Failed

    关闭mod_unique_id.so

    #LoadModule unique_id_module libexec/apache22/mod_unique_id.so

  • 王炜

    # echo ‘accf_data_load=”YES”‘ >> /etc/rc.conf
    # echo ‘accf_http_load=”YES”‘ >> /etc/rc.conf

    # echo ‘apache22_enable=”YES”‘ >> /etc/rc.conf
    # echo ‘apache22ssl_enable=”YES”‘ >> /etc/rc.conf

    之前

    accf_data_load=”YES”
    accf_http_load=”YES”
    apache22_enable=”YES”
    apache22ssl_enable=”YES”

    启动错误
    httpd: apr_sockaddr_info_get() failed for aewb
    httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName

    修改/etc/rc.conf
    hostname=”your ServerName”
    修改/usr/local/etc/apache22/httpd.conf
    ServerName your ServerName:80
    修改/etc/hosts
    ::1 localhost your ServerName
    127.0.0.1 localhost your ServerName

    your ServerName 格式是 host.your-domain.com

    启动apache22
    kldload accf_data
    kldload accf_http
    /usr/local/etc/rc.d/apache22 start

Leave a Reply to 王炜 Cancel reply