[英]Configure Apache2 for Laravel 5.1
我使用ubuntu服务器并安装apache2。
我在laravel.conf中写道:
<VirtualHost *:80>
ServerName localhost
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/public
<Directory /var/www/html>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
然后我重新启动Apache2。 不会工作...
我也在/html
文件夹中创建.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
还:在/ pubic文件夹中,我添加.htaccess:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
现在查看文件夹的工作状态...因此,当我访问: /auth/login
一切都很好,我看到了DOMhtml,但是当我尝试单击登录后,显示500错误:
我该如何解决我的问题? Apache2有什么问题? 如何正确配置它们?
不要更改.htaccess
。 尝试这个:
<VirtualHost *:80>
ServerName netracuni.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/public
<Directory /var/www/html/public>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
另外,在storage
目录上设置写许可权:
chmod -R 775 storage
重新启动Apache。
http://laravel-recipes.com/recipes/25/creating-an-apache-virtualhost
如果id不起作用,它将返回什么错误?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.