我正在使用 Ubuntu 16.04 桌面,并尝试安装一些 Composer Web 项目。
默认情况下,当您运行时,composer create-project
它会在您的项目文件夹内安装一个“web”目录,其中包含所有需要的公共文件。
我正在尝试让 apache 顺利地运行这个,因为权限显然默认不允许这样做。
我已将网站安装在 /home/'username redacted'/sites/tcrp/web
我为该网站设置了以下 .conf
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName tcrp.localhost
ServerAdmin webmaster@localhost
DocumentRoot /home/<username redacted>/sites/thecrewrp/web
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
<Directory /home/<username redacted>/sites/thecrewrp/web>
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Require all granted
Allow from all
</Directory>
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
每当我尝试通过http://tcrp.localhost,我收到“禁止”错误。现在,如果我将 Web 文件放在“web”文件夹之外(例如 /home/'username redacted'/sites/blahsite),它们可以正常托管,并且可以正常工作。但是,如果我尝试将任何内容放在“web”文件夹中(这是 composer 的运行方式),我会在 apache error.log 文件中收到禁止,然后是“服务器配置拒绝客户端”