Fedora
未從預期目錄中讀取 index.html
我正在嘗試在 Fedora 18 安裝上設置虛擬主機。這是在機架空間。
Following is my /etc/httpd/conf/httpd.conf (I deleted all the comment lines for brevity): ServerRoot "/etc/httpd" Listen 80 Include conf.modules.d/*.conf User apache Group apache ServerAdmin root@localhost <Directory /> AllowOverride none Require all denied </Directory> DocumentRoot "/var/www/html" <Directory "/var/www"> AllowOverride None # Allow open access: Require all granted </Directory> <Directory "/var/www/html"> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> <IfModule dir_module> DirectoryIndex index.html </IfModule> <Files ".ht*"> Require all denied </Files> ErrorLog "logs/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 "logs/access_log" combined </IfModule> <IfModule alias_module> ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" </IfModule> <Directory "/var/www/cgi-bin"> AllowOverride None Options None Require all granted </Directory> <IfModule mime_module> TypesConfig /etc/mime.types AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddType text/html .shtml AddOutputFilter INCLUDES .shtml </IfModule> AddDefaultCharset UTF-8 MIMEMagicFile conf/magic EnableSendfile on Include conf.d/*.conf
這是我的 /etc/httpd/conf.d/00-rails.conf
<VirtualHost *:80> ServerName test.myinstall.com DocumentRoot /home/test/public <Directory /home/test/public> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride all Order deny,allow Allow from all Options -MultiViews </Directory> </VirtualHost>
在我的 /home/test/public 中,我添加了一個 index.html 文件,其中包含以下內容:
<h3>This is a test page</h3>
問題是當我訪問 test.myinstall.com 時,我看到 Fedora 測試頁面,而不是 index.html 中的消息
當我執行 apachectl -S 時,我得到的是:
VirtualHost configuration: *:80 is a NameVirtualHost default server test.myinstall.com (/etc/httpd/conf.d/00-rails.conf:1) port 80 namevhost test.myinstall.com (/etc/httpd/conf.d/00-rails.conf:1) port 80 namevhost test.myinstall.com (/etc/httpd/conf.d/00-rails.conf:1) ServerRoot: "/etc/httpd" Main DocumentRoot: "/var/www/html" Main ErrorLog: "/etc/httpd/logs/error_log" Mutex authn-socache: using_defaults Mutex default: dir="/run/httpd/" mechanism=default Mutex mpm-accept: using_defaults Mutex authdigest-opaque: using_defaults Mutex proxy-balancer-shm: using_defaults Mutex rewrite-map: using_defaults Mutex authdigest-client: using_defaults PidFile: "/run/httpd/httpd.pid" Define: DUMP_VHOSTS Define: DUMP_RUN_CFG User: name="apache" id=48 Group: name="apache" id=48
附加資訊:
這是我的 /etc/hosts 文件:
#this is the IPv6 address #I used xxx to mask the real address 2001:xxxx:xxxx:xxxx:xxxx:d0a5:ff04:ab82 test.myinstall.com #this is the externally accessible IP address 64.49.xxx.xx test.myinstall.com #this is the internal Rackspace IP address 10.xxx.xx.xx test.myinstall.com
有任何想法嗎?
阿帕奇錯誤日誌:
[Tue Apr 23 23:28:25.617954 2013] [suexec:notice] [pid 25527] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) [ 2013-04-23 23:28:26.0266 25531/7f638fcdd740 agents/HelperAgent/Main.cpp:554 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.25527/generation-0/request.socket [ 2013-04-23 23:28:26.0432 25536/7f4251e71800 agents/LoggingAgent/Main.cpp:272 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.25527/generation-0/logging.socket [Tue Apr 23 23:28:26.084527 2013] [auth_digest:notice] [pid 25527] AH01757: generating secret for digest authentication ... [ 2013-04-23 23:28:27.0253 25550/7f5362aa7740 agents/HelperAgent/Main.cpp:554 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.25527/generation-1/request.socket [Tue Apr 23 23:28:27.041518 2013] [lbmethod_heartbeat:notice] [pid 25527] AH02282: No slotmem from mod_heartmonitor [ 2013-04-23 23:28:27.0498 25555/7f21c5883800 agents/LoggingAgent/Main.cpp:272 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.25527/generation-1/logging.socket [Tue Apr 23 23:28:27.064938 2013] [mpm_prefork:notice] [pid 25527] AH00163: Apache/2.4.4 (Fedora) Phusion_Passenger/4.0.0.rc6 configured -- resuming normal operations [Tue Apr 23 23:28:27.065043 2013] [core:notice] [pid 25527] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND' [Tue Apr 23 23:28:33.851049 2013] [authz_core:error] [pid 25565] [client 66.xxx.141.202:2300] AH01630: client denied by server configuration: /home/test/public/ [Tue Apr 23 23:28:35.637170 2013] [authz_core:error] [pid 25565] [client 66.xxx.141.202:2300] AH01630: client denied by server configuration: /home/test/public/ [Tue Apr 23 23:50:49.520907 2013] [authz_core:error] [pid 25567] [client 66.xxx.141.202:56561] AH01630: client denied by server configuration: /home/test/public/ [Tue Apr 23 23:50:49.744630 2013] [authz_core:error] [pid 25567] [client 66.xxx.141.202:56561] AH01630: client denied by server configuration: /home/test/public/favicon.ico
/home/test 的權限:
drwxr-xr-x. 2 test apache 4096 Apr 10 05:17 app drwxr-xr-x. 2 test apache 4096 Apr 10 20:11 public
錯誤日誌中顯示的問題是您沒有讀取
/home/test/public
目錄的權限。[Tue Apr 23 23:28:33.851049 2013] [authz_core:error] [pid 25565] [client 66.xxx.141.202:2300] AH01630: client denied by server configuration: /home/test/public/
原因是您拒絕訪問它:
<Directory /> AllowOverride none Require all denied </Directory>
雖然您有一個單獨的
<Directory /home/test/public>
條目,但它不允許訪問。它似乎有舊的 Apache 2.2-style和Order
指令。這些在 Apache 2.4 中無效,並且已被指令替換。Allow``Deny``Require
要解決此問題,請允許訪問該目錄。刪除舊指令並用新指令替換它們:
<Directory /home/test/public> Require all granted </Directory>