如何诊断在 Fedora 上访问 Apache 站点的问题?
我删除了 /var/log 中的所有内容,然后重新启动了 rsyslog 和 httpd。然后cat /var/log/messages
显示:
Jun 3 21:43:09 localhost kernel: imklog 5.8.10, log source = /proc/kmsg started.
Jun 3 21:43:09 localhost rsyslogd: [origin software="rsyslogd" swVersion="5.8.10" x-pid="29043" x-info="http://www.rsyslog.com"] start
Jun 3 21:43:15 localhost httpd[29065]: [Mon Jun 03 21:43:15 2013] [warn] module alias_module is already loaded, skipping
Jun 3 21:43:15 localhost httpd[29065]: [Mon Jun 03 21:43:15 2013] [warn] module auth_basic_module is already loaded, skipping
Jun 3 21:43:15 localhost httpd[29065]: [Mon Jun 03 21:43:15 2013] [warn] module authn_file_module is already loaded, skipping
Jun 3 21:43:15 localhost httpd[29065]: [Mon Jun 03 21:43:15 2013] [warn] module authz_default_module is already loaded, skipping
Jun 3 21:43:15 localhost httpd[29065]: [Mon Jun 03 21:43:15 2013] [warn] module authz_groupfile_module is already loaded, skipping
Jun 3 21:43:15 localhost httpd[29065]: [Mon Jun 03 21:43:15 2013] [warn] module authz_host_module is already loaded, skipping
Jun 3 21:43:15 localhost httpd[29065]: [Mon Jun 03 21:43:15 2013] [warn] module authz_user_module is already loaded, skipping
Jun 3 21:43:15 localhost httpd[29065]: [Mon Jun 03 21:43:15 2013] [warn] module autoindex_module is already loaded, skipping
Jun 3 21:43:15 localhost httpd[29065]: [Mon Jun 03 21:43:15 2013] [warn] module deflate_module is already loaded, skipping
Jun 3 21:43:15 localhost httpd[29065]: [Mon Jun 03 21:43:15 2013] [warn] module dir_module is already loaded, skipping
Jun 3 21:43:15 localhost httpd[29065]: [Mon Jun 03 21:43:15 2013] [warn] module env_module is already loaded, skipping
Jun 3 21:43:15 localhost httpd[29065]: [Mon Jun 03 21:43:15 2013] [warn] module headers_module is already loaded, skipping
Jun 3 21:43:15 localhost httpd[29065]: [Mon Jun 03 21:43:15 2013] [warn] module log_config_module is already loaded, skipping
Jun 3 21:43:15 localhost httpd[29065]: [Mon Jun 03 21:43:15 2013] [warn] module mime_module is already loaded, skipping
Jun 3 21:43:15 localhost httpd[29065]: [Mon Jun 03 21:43:15 2013] [warn] module negotiation_module is already loaded, skipping
Jun 3 21:43:15 localhost httpd[29065]: [Mon Jun 03 21:43:15 2013] [warn] module rewrite_module is already loaded, skipping
Jun 3 21:43:15 localhost httpd[29065]: [Mon Jun 03 21:43:15 2013] [warn] module setenvif_module is already loaded, skipping
Jun 3 21:43:15 localhost httpd[29065]: [Mon Jun 03 21:43:15 2013] [warn] module ssl_module is already loaded, skipping
Jun 3 21:43:15 localhost httpd[29065]: [Mon Jun 03 21:43:15 2013] [warn] module status_module is already loaded, skipping
Jun 3 21:43:15 localhost httpd[29065]: [Mon Jun 03 21:43:15 2013] [warn] module wsgi_module is already loaded, skipping
Jun 3 21:43:15 localhost httpd[29065]: [Mon Jun 03 21:43:15 2013] [warn] NameVirtualHost *:444 has no VirtualHosts
Jun 3 21:43:15 localhost httpd[29065]: [Mon Jun 03 21:43:15 2013] [warn] NameVirtualHost *:443 has no VirtualHosts
Jun 3 21:43:15 localhost systemd[1]: PID file /var/run/httpd/httpd.pid not readable (yet?) after start.
[root@localhost ~]# ls -lah /var/run/httpd
total 4.0K
drwxr-xr-x 2 apache apache 60 Jun 3 21:43 .
drwxr-xr-x 31 root root 1.1K Jun 3 21:43 ..
-rw-r--r-- 1 root root 6 Jun 3 21:43 httpd.pid
[root@localhost ~]# ls -lah /var/log/httpd
total 12K
drwxr-xr-x 2 apache apache 4.0K Jun 3 21:43 .
drwxr-xr-x 3 root root 4.0K Jun 3 21:43 ..
-rw-r--r-- 1 root root 0 Jun 3 21:43 mysite-access.log
-rw-r--r-- 1 root root 0 Jun 3 21:43 mysite-error.log
-rw-r--r-- 1 root root 0 Jun 3 21:43 mysite-rewrite.log
-rw-r--r-- 1 root root 2.3K Jun 3 21:43 error.log
srwx------ 1 apache root 0 Jun 3 21:43 wsgi.29066.0.1.sock
我的 /var/log/httpd/error.log 显示:
[Mon Jun 03 21:43:15 2013] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon Jun 03 21:43:15 2013] [notice] SSL FIPS mode disabled
[Mon Jun 03 21:43:15 2013] [warn] module alias_module is already loaded, skipping
[Mon Jun 03 21:43:15 2013] [warn] module auth_basic_module is already loaded, skipping
[Mon Jun 03 21:43:15 2013] [warn] module authn_file_module is already loaded, skipping
[Mon Jun 03 21:43:15 2013] [warn] module authz_default_module is already loaded, skipping
[Mon Jun 03 21:43:15 2013] [warn] module authz_groupfile_module is already loaded, skipping
[Mon Jun 03 21:43:15 2013] [warn] module authz_host_module is already loaded, skipping
[Mon Jun 03 21:43:15 2013] [warn] module authz_user_module is already loaded, skipping
[Mon Jun 03 21:43:15 2013] [warn] module autoindex_module is already loaded, skipping
[Mon Jun 03 21:43:15 2013] [warn] module deflate_module is already loaded, skipping
[Mon Jun 03 21:43:15 2013] [warn] module dir_module is already loaded, skipping
[Mon Jun 03 21:43:15 2013] [warn] module env_module is already loaded, skipping
[Mon Jun 03 21:43:15 2013] [warn] module headers_module is already loaded, skipping
[Mon Jun 03 21:43:15 2013] [warn] module log_config_module is already loaded, skipping
[Mon Jun 03 21:43:15 2013] [warn] module mime_module is already loaded, skipping
[Mon Jun 03 21:43:15 2013] [warn] module negotiation_module is already loaded, skipping
[Mon Jun 03 21:43:15 2013] [warn] module rewrite_module is already loaded, skipping
[Mon Jun 03 21:43:15 2013] [warn] module setenvif_module is already loaded, skipping
[Mon Jun 03 21:43:15 2013] [warn] module ssl_module is already loaded, skipping
[Mon Jun 03 21:43:15 2013] [warn] module status_module is already loaded, skipping
[Mon Jun 03 21:43:15 2013] [warn] module wsgi_module is already loaded, skipping
[Mon Jun 03 21:43:15 2013] [notice] Digest: generating secret for digest authentication ...
[Mon Jun 03 21:43:15 2013] [notice] Digest: done
[Mon Jun 03 21:43:15 2013] [notice] SSL FIPS mode disabled
[Mon Jun 03 21:43:15 2013] [warn] mod_wsgi: Compiled for Python/2.7.2.
[Mon Jun 03 21:43:15 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Mon Jun 03 21:43:15 2013] [notice] Apache/2.2.22 (Unix) DAV/2 mod_ssl/2.2.22 OpenSSL/1.0.0j-fips mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
我的 /etc/httpd/sites-enabled/mydomain.conf 中仅启用了一个站点:
<VirtualHost *:80>
ServerName www.mydomain.com
ServerAlias mydomain.com *.mydomain.com
DocumentRoot /usr/local/mydomain
RewriteEngine On
AllowEncodedSlashes On
Alias /media/ /usr/local/mydomain/media
<Directory /usr/local/mydomain>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
</VirtualHost>
运行netstat -tulpn
显示httpd已绑定到80端口。
在我的 /etc/hosts 中我有:
192.168.1.2 www.mydomain.com
这是服务器的域。
我还在服务器上禁用了 iptables service iptables stop
。
我有一个用于测试的示例文件cat /usr/local/mydomain/media/test.txt
::
hello world
但是当我访问http://www.mydomain.com/media/test.txt我收到“Firefox 无法与 www.mydomain.com 的服务器建立连接”的提示,好像服务器根本没有运行。
我在 /var/log/messages 或 /var/log/httpd/error.log 中没有看到任何错误消息。我做错了什么?
答案1
您必须提供多一点的信息 - 确保端口可访问,您是否能够显示默认的 apache“它有效”页面,您还可以尝试从其他框的命令行连接到端口 80 上的此框,看看您是否可以连接。