虚拟主机不在Fedora 22中工作

最近我已经从Ubuntu转到Fedora Workstation作为我的开发环境,以便更好地理解centOS服务器(以及其他原因)。

我一直在试图build立一个本地LAMP堆栈进行开发。

这是我的atm

httpd Apache/2.4.16 (Fedora), runs as apache/apache, mod_php is disabled, handler is "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost" php 5.6.14 php-fpm runs as apache/apache, path is /run/php-fpm/www.sock, process type is mpm_event 

/etc/httpd/conf.d/php.conf

 <IfModule !mod_php5.c> <FilesMatch \.php$> SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost" </FilesMatch> </IfModule> 

我还没有真正引起/etc/httpd/conf/httpd.conf任何设置。 服务器和PHP似乎为/var/www/html正常工作,但是当我尝试创build一个新的VirtualHost ,我得到了所有目录403 。 我正在尝试通过添加一个configuration文件到一个新的虚拟主机

/etc/httpd/conf.d/sites.conf

 <VirtualHost *:80> ServerName site1.local ServerAlias site1alias.local DocumentRoot /home/myuser/Projects/site1/www <Directory /home/myuser/Projects/site1/www> AllowOverride All Require all granted </Directory> </VirtualHost> 

httpd -S

 AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message VirtualHost configuration: *:80 site1.local (/etc/httpd/conf.d/sites.conf:4) ServerRoot: "/etc/httpd" Main DocumentRoot: "/var/www/html" Main ErrorLog: "/etc/httpd/logs/error_log" Mutex default: dir="/run/httpd/" mechanism=default Mutex authdigest-opaque: using_defaults Mutex proxy-balancer-shm: using_defaults Mutex rewrite-map: using_defaults Mutex authdigest-client: using_defaults Mutex lua-ivm-shm: using_defaults Mutex proxy: using_defaults Mutex authn-socache: 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文件

 127.0.0.1 localhost gpc local localhost.localdomain site1.local site1alias.local ::1 localhost gpc local localhost.localdomain 

SELinux通过使用setenforce 0设置为'permissive'(似乎显示警告但允许执行操作)。

每当我尝试浏览http://localhost/http://site1.local/ ,我都会收到

Forbidden: You don't have permission to access / on this server.

也许是

 AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message 

与此有关? 我已经尝试在/etc/httpd/conf/httpd.conf ServerName localhost指令,但它没有效果。 我的想法已经过时了。 我觉得我在configuration中缺less一些东西。 任何帮助或build议将不胜感激。

编辑

来自/var/log/httpd/error_log条目:

 [Sat Oct 31 17:29:33.253428 2015] [core:notice] [pid 844:tid 140376890374272] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0 [Sat Oct 31 17:29:33.259649 2015] [suexec:notice] [pid 844:tid 140376890374272] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message [Sat Oct 31 17:29:33.274149 2015] [auth_digest:notice] [pid 844:tid 140376890374272] AH01757: generating secret for digest authentication ... [Sat Oct 31 17:29:33.275309 2015] [lbmethod_heartbeat:notice] [pid 844:tid 140376890374272] AH02282: No slotmem from mod_heartmonitor [Sat Oct 31 17:29:33.279406 2015] [mpm_event:notice] [pid 844:tid 140376890374272] AH00489: Apache/2.4.16 (Fedora) configured -- resuming normal operations [Sat Oct 31 17:29:33.279437 2015] [core:notice] [pid 844:tid 140376890374272] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND' [Sat Oct 31 17:30:18.500583 2015] [core:error] [pid 937:tid 140376476202752] (13)Permission denied: [client 127.0.0.1:42036] AH00035: access to / denied (filesystem path '/home/myuser/Projects') because search permissions are missing on a component of the path [Sat Oct 31 17:30:18.667997 2015] [core:error] [pid 937:tid 140376459417344] (13)Permission denied: [client 127.0.0.1:42036] AH00035: access to /favicon.ico denied (filesystem path '/home/myuser/Projects') because search permissions are missing on a component of the path, referer: http://site1.local/ 

权限

 apache/apache 755 /var/www/html/ apache/apache 755 /home/myuser/Projects/site1/ 

这是你的错误。 仔细地看:

 [Sat Oct 31 17:30:18.500583 2015] [core:error] [pid 937:tid 140376476202752] (13)Permission denied: [client 127.0.0.1:42036] AH00035: access to / denied (filesystem path '/home/myuser/Projects') because search permissions are missing on a component of the path [Sat Oct 31 17:30:18.667997 2015] [core:error] [pid 937:tid 140376459417344] (13)Permission denied: [client 127.0.0.1:42036] AH00035: access to /favicon.ico denied (filesystem path '/home/myuser/Projects') because search permissions are missing on a component of the path, referer: http://site1.local/ 

发生这种情况是因为Apache没有权限search (下载x权限)其中一个父目录。

要解决这个问题,首先检查哪个父目录缺less适当的权限,比如用namei -l /home/myuser/Projects/index.php 。 find所有用户缺lessx权限的目录,并使用chmod a+x /directory给予正确的权限。

错误可能不符合fqdn与它无关,你可以通过添加一个条目到/ etc / hosts中,使用你的外部ip,然后是主机名。 关于PHP的错误:任何在Apache的日志?

编辑:

请检查/ home / myuser /项目的权限,httpd用户apache(至lessrx)