我在将新的laravel应用程序部署到我的数字海洋帐户时遇到了一些麻烦。我按照本教程中的步骤概述: http://davidmyers.name/post/laravel-on-digital-ocean
然而我发现在尝试访问索引页面时,我得到:
Forbidden
You don't have permission to access / on this server.
Apache/2.4.7 (Ubuntu) Server at www.scheduleify.com Port 80
但是,我可以访问www.scheduleify.com/phpmyadmin来访问PHPMyAdmin
我觉得这与将默认目录设置为公用文件夹有关。
在上面链接的文章中,作者提到打开文件时:
/etc/apache2/sites-enabled/000-default.conf
应该看到以下两行:
DocumentRoot /var/www
<Directory /var/www>
这是我的整个文件,似乎缺少其中一个(我已经修改了相应的那个):
<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 www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /root/scheduleify/public
# 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
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
我注意到的另一件事:如果我进入我的根目录,进入克隆的存储库/项目文件夹,并尝试运行php artisan,我收到错误:
Mcrypt PHP extension required.
但是,如果我从同一目录运行命令mcrypt,我会得到:
mcrypt: Encrypted data will not be written to a terminal.
Redirect the output instead.
Use the --help parameter for more help.
这表明mcrypt正在运作。非常感谢任何输入/帮助。我非常接近放弃,我已经在这里待了好几个小时而无处可去。
更新:第一个错误已解决。
403错误仍然存在;检查apache2日志,我发现了这个错误:
[Fri Jan 16 09:38:31.855624 2015] [core:error] [pid 5641]
(13)Permission denied: [client [removed]] AH00035: access to / denied
(filesystem path '/root/scheduleify') because search permissions are
missing on a component of the path
答案 0 :(得分:2)
对于第一个问题:
You don't have permission to access / on this server.
这通常是权限问题。例如root owns / root / scheduleify和web服务器(通常是ubuntu&amp; debian上的www-data)无法读取该目录。
chown -R www-data: /root/scheduleify
如果这确实解决了问题,则每次以root用户身份上传新文件时都需要重新运行此命令。
对于第二个问题:
Mcrypt PHP extension required.
可以修复:
apt-get install php5-mcrypt
终于重启apache。
sudo service apache2 restart
答案 1 :(得分:0)
问题在于我将应用程序放在根目录中...这是一个坏主意,需要额外的apache配置。
通过将项目从根文件夹(root / project)移到var / www / html / project目录中,并完成本文中概述的相同过程,我能够让应用程序正常工作! / p>