我'm deploying a webapp to a digitalOcean droplet and it displays the home route just fine. I have dependencies installed, Apache conf pointing to laravel'的公共文件夹,权限给 www-data
所以Apache可以使用该文件夹,但是,当我尝试访问站点中定义的链接时,已经在routes文件中定义,例如 /about
我收到404错误 .
为什么会这样?
Droplet运行Ubuntu 16.04,我有Apache和php7 .
我正在读这两篇文章:1和2但没有运气
My apache conf file is
<Directory /var/www/html/analizalabs/public>
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
My sites-available file
ServerAdmin tecnofunk@cryptolab.net
DocumentRoot /var/www/html/analizalabs/public/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Part of my routes file
Route::get('/','PagesController@home');
Route::get('/about','PagesController@about');
Route::get('/contact','PagesController@contact');
My htaccess file
<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>
Permissions like...
drwxrwxr-x 8 www-data dev 4096 Sep 9 21:58 public
其中 dev
是我用来修改该目录中具有rw访问权限的文件的组 .
1 回答
似乎重写模块未启用,您必须使用以下命令启用它:
注1:ubuntu中默认不启用重写模块
注意2:您可以在mac中使用apache2ctl -M和apachectl -M检查已启用的模块(或两者中的httpd -M)