2009-04-20 295 views
0

我最近在我的FreeBSD機器上安裝了Apache。一切工作正常;通過本地計算機進行遠程登錄,並通過我的XP盒(通過我的DSL路由器連接)上的Firefox通過http獲得「It works!」。頁。然後,我重新啓動了我的BSD機器,現在既不是telnet(通過su和我的普通帳戶),也不允許Firefox連接 - 我保持兩個403錯誤。我已經檢查過許多權限,並經過了httpd.conf多次,但我無法弄清楚。我的httpd.conf文件如下:Apache拒絕連接

ServerRoot "/usr/local" 

Listen 80 

LoadModule authn_file_module libexec/apache22/mod_authn_file.so 
LoadModule authn_dbm_module libexec/apache22/mod_authn_dbm.so 
LoadModule authn_anon_module libexec/apache22/mod_authn_anon.so 
LoadModule authn_default_module libexec/apache22/mod_authn_default.so 
LoadModule authn_alias_module libexec/apache22/mod_authn_alias.so 
LoadModule authz_host_module libexec/apache22/mod_authz_host.so 
LoadModule authz_groupfile_module libexec/apache22/mod_authz_groupfile.so 
LoadModule authz_user_module libexec/apache22/mod_authz_user.so 
LoadModule authz_dbm_module libexec/apache22/mod_authz_dbm.so 
LoadModule authz_owner_module libexec/apache22/mod_authz_owner.so 
LoadModule authz_default_module libexec/apache22/mod_authz_default.so 
LoadModule auth_basic_module libexec/apache22/mod_auth_basic.so 
LoadModule auth_digest_module libexec/apache22/mod_auth_digest.so 
LoadModule file_cache_module libexec/apache22/mod_file_cache.so 
LoadModule cache_module libexec/apache22/mod_cache.so 
LoadModule disk_cache_module libexec/apache22/mod_disk_cache.so 
LoadModule dumpio_module libexec/apache22/mod_dumpio.so 
LoadModule include_module libexec/apache22/mod_include.so 
LoadModule filter_module libexec/apache22/mod_filter.so 
LoadModule charset_lite_module libexec/apache22/mod_charset_lite.so 
LoadModule deflate_module libexec/apache22/mod_deflate.so 
LoadModule log_config_module libexec/apache22/mod_log_config.so 
LoadModule logio_module libexec/apache22/mod_logio.so 
LoadModule env_module libexec/apache22/mod_env.so 
LoadModule mime_magic_module libexec/apache22/mod_mime_magic.so 
LoadModule cern_meta_module libexec/apache22/mod_cern_meta.so 
LoadModule expires_module libexec/apache22/mod_expires.so 
LoadModule headers_module libexec/apache22/mod_headers.so 
LoadModule usertrack_module libexec/apache22/mod_usertrack.so 
LoadModule unique_id_module libexec/apache22/mod_unique_id.so 
LoadModule setenvif_module libexec/apache22/mod_setenvif.so 
LoadModule version_module libexec/apache22/mod_version.so 
LoadModule ssl_module libexec/apache22/mod_ssl.so 
LoadModule mime_module libexec/apache22/mod_mime.so 
LoadModule dav_module libexec/apache22/mod_dav.so 
LoadModule status_module libexec/apache22/mod_status.so 
LoadModule autoindex_module libexec/apache22/mod_autoindex.so 
LoadModule asis_module libexec/apache22/mod_asis.so 
LoadModule info_module libexec/apache22/mod_info.so 
LoadModule cgi_module libexec/apache22/mod_cgi.so 
LoadModule dav_fs_module libexec/apache22/mod_dav_fs.so 
LoadModule vhost_alias_module libexec/apache22/mod_vhost_alias.so 
LoadModule negotiation_module libexec/apache22/mod_negotiation.so 
LoadModule dir_module libexec/apache22/mod_dir.so 
LoadModule imagemap_module libexec/apache22/mod_imagemap.so 
LoadModule actions_module libexec/apache22/mod_actions.so 
LoadModule speling_module libexec/apache22/mod_speling.so 
LoadModule userdir_module libexec/apache22/mod_userdir.so 
LoadModule alias_module libexec/apache22/mod_alias.so 
LoadModule rewrite_module libexec/apache22/mod_rewrite.so 

<IfModule !mpm_netware_module> 
<IfModule !mpm_winnt_module> 

User www 
Group www 

</IfModule> 
</IfModule> 

ServerAdmin [email protected] 

ServerName 192.168.2.12:80 

DocumentRoot /home/prosperity/html 

<Directory /> 
    AllowOverride None 
    Order deny,allow 
    Deny from all 
</Directory> 

<Directory /home/prosperity/html> 

    Options Indexes FollowSymLinks 

    AllowOverride None 

    Order allow,deny 
    Allow from all 

</Directory> 

<IfModule dir_module> 
    DirectoryIndex index.html 
</IfModule> 

<FilesMatch "^\.ht"> 
    Order allow,deny 
    Deny from all 
    Satisfy All 
</FilesMatch> 

ErrorLog "/var/log/httpd-error.log" 

LogLevel warn 

<IfModule log_config_module> 

    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined 
    LogFormat "%h %l %u %t \"%r\" %>s %b" common 

    <IfModule logio_module> 
     # You need to enable mod_logio.c to use %I and %O 
     LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio 
    </IfModule> 

    CustomLog "/var/log/httpd-access.log" combined 
</IfModule> 

<IfModule alias_module> 

    ScriptAlias /cgi-bin/ "/usr/local/www/apache22/cgi-bin/" 

</IfModule> 

<IfModule cgid_module> 

</IfModule> 

<Directory "/usr/local/www/apache22/cgi-bin"> 
    AllowOverride None 
    Options None 
    Order allow,deny 
    Allow from all 
</Directory> 

DefaultType text/plain 

<IfModule mime_module> 

    TypesConfig etc/apache22/mime.types 

    AddType application/x-compress .Z 
    AddType application/x-gzip .gz .tgz 

</IfModule> 

<IfModule ssl_module> 
SSLRandomSeed startup builtin 
SSLRandomSeed connect builtin 
</IfModule> 

Include etc/apache22/Includes/*.conf 

編輯:克里斯問所以這裏的一些日誌文件中的數據是。

首先,的httpd-error.log中

[Sun Apr 19 22:37:35 2009] [notice] Digest: done 
[Sun Apr 19 22:37:36 2009] [notice] Apache/2.2.9 (FreeBSD) mod_ssl/2.2.9 OpenSSL/0.9.8e DAV/2 configured -- resuming normal operations 
[Mon Apr 20 00:00:28 2009] [notice] caught SIGTERM, shutting down 
[Mon Apr 20 00:01:18 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache] 
[Mon Apr 20 00:01:19 2009] [notice] Digest: generating secret for digest authentication ... 
[Mon Apr 20 00:01:19 2009] [notice] Digest: done 
[Mon Apr 20 00:01:20 2009] [notice] Apache/2.2.9 (FreeBSD) mod_ssl/2.2.9 OpenSSL/0.9.8e DAV/2 configured -- resuming normal operations 
[Mon Apr 20 00:01:26 2009] [error] [client 192.168.2.10] (13)Permission denied: access to/denied 
[Mon Apr 20 00:01:54 2009] [error] [client 192.168.2.12] (13)Permission denied: access to/denied 
[Mon Apr 20 00:02:12 2009] [error] [client 192.168.2.12] (13)Permission denied: access to /home/prosperity/html/index.html denied 

二的httpd-的access.log:

192.168.2.12 - - [19/Apr/2009:21:31:40 -0400] "GET/" 403 202 "-" "-" 
192.168.2.10 - - [19/Apr/2009:21:51:07 -0400] "GET/HTTP/1.1" 403 202 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8 (.NET CLR 3.5.30729)" 
192.168.2.12 - - [19/Apr/2009:22:00:29 -0400] "GET/" 403 202 "-" "-" 
192.168.2.12 - - [19/Apr/2009:22:00:54 -0400] "GET /home/prosperity/test.html" 403 227 "-" "-" 
192.168.2.12 - - [19/Apr/2009:22:01:13 -0400] "GET /home/prosperity/index.html" 403 228 "-" "-" 
127.0.0.1 - - [19/Apr/2009:22:07:00 -0400] "GET/HTTP/1.0" 403 202 "-" "-" 
192.168.2.12 - - [19/Apr/2009:22:13:12 -0400] "GET /home/prosperity/html/test.html" 403 232 "-" "-" 
192.168.2.10 - - [20/Apr/2009:00:01:26 -0400] "GET/HTTP/1.1" 403 202 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8 (.NET CLR 3.5.30729)" 
192.168.2.12 - - [20/Apr/2009:00:01:54 -0400] "GET /" 403 202 "-" "-" 
192.168.2.12 - - [20/Apr/2009:00:02:12 -0400] "GET /home/prosperity/html/index.html" 403 233 "-" "-" 
+0

你有一些日誌文件來看待?只要10行左右就行。 – 2009-04-20 03:42:42

回答

1

它看起來像/家庭/繁榮/ HTML已經從錯誤日誌中錯誤的權限。

它應該是由一羣可讀:WWW和用戶:在您的http.conf定義WWW

0

是在開機啓動了PF?

您可以像檢查的/etc/rc.conf

pf_enable="YES" 

如果是的話那麼它可能阻斷telnet和HTTP傳入的連接。您可以在/etc/pf.rules中添加telnet/apache的規則,或者將以上設置更改爲「NO」

你是否確定這兩個守護進程在啓動時重新啓動? 根據您如何安裝和配置telnet和Apache,他們可能會錯過正確的設置,以在啓動時自動啓動。

再次檢查的/etc/rc.conf類似:

apache_enable="YES" 

apache22_enable="YES" 

就像Chris在評論中說,這是很難猜測不知道更多的從日誌。

還仔細檢查你其實做有一個IP地址。 嘿,你永遠不會知道。

+0

我的rc.conf文件根本沒有pf_enable選項。然而,它確實有apache22_enable =「YES和apache22_http_accept_enable =」 YES」行。 – gvkv 2009-04-20 04:08:58

+0

/etc/defaults/rc.conf中具有配置了pf_enable =‘NO’,所以我會改變這種狀況。任何想法,爲什麼它之前的工作? – gvkv 2009-04-20 04:14:41