[英]Laravel 5.1 on apache2 wont to start
Iadd laravel files into folder /var/www/html/laravel3
after that I change apache2.conf file I have: 我将laravel文件添加到
/var/www/html/laravel3
laravel3文件夹中,之后我更改了apache2.conf文件:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/laravel3
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
...
but when I try http://mywebsite.com I get: 但是当我尝试http://mywebsite.com时,我得到了:
Not Found
未找到
The requested URL /auth/login was not found on this server.
在此服务器上找不到请求的URL / auth / login。
Also I delete .htaccess file from /laravel3 folder 我也从/ laravel3文件夹中删除.htaccess文件
What to do now? 现在做什么?
in apache2 I have: 在apache2中,我有:
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
in sites-available/laravel.conf I have: 在sites-available / laravel.conf中,我有:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName bedbids.com
DocumentRoot "/var/www/html/laravel3/public"
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "/var/www/html/laravel3/public">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Do not remove the .htaccess
file, it rewrites requests to the index.php
. 不要删除
.htaccess
文件,它会将请求重写为index.php
。
For your apache config, the DocumentRoot
should point to the public directory and you should set AllowOverride All
, otherwise the htaccess is ignored. 对于您的apache配置,
DocumentRoot
应该指向公共目录,并且您应该设置AllowOverride All
,否则htaccess将被忽略。
This should work for you: 这应该为您工作:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/laravel3/public
<Directory /var/www/html/laravel3/public/>
AllowOverride All
</Directory>
...
After that change, restart apache and it should be up and running. 更改之后,重新启动apache,它应该已启动并正在运行。
You should point Apache to a public
directory inside Laravel root, for example: 您应该将Apache指向Laravel根目录内的
public
目录,例如:
DocumentRoot "/var/www/html/laravel3/public"
<Directory "/var/www/html/laravel3/public">
Also, you shouldn't edit or delete .htaccess
. 另外,您不应编辑或删除
.htaccess
。
After you made these changes, do not forget to reboot Apache. 进行这些更改之后,请不要忘记重启Apache。
Update 更新
Original .htaccess
: 原始
.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]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.