Я пытаюсь настроить виртуальный хост в системе Fedora 18. Это на Rackspace.
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
, Allow
и Deny
директивы. Они не действуют в Apache 2.4 и были заменены на Require
директива.
Чтобы решить проблему, разрешите доступ к каталогу. Удалите старые директивы и замените их новыми:
<Directory /home/test/public>
Require all granted
</Directory>