【发布时间】:2017-10-24 09:58:48
【问题描述】:
我已经为我的服务器部署了一个新的 laravel 安装,同时我将我的 apache2 配置如下:
我在/etc/apache2/sites-available/ 中添加了000-default.conf 文件,如下所示:
DocumentRoot /var/www/html
<Directory /var/www/html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
Require all granted
</Directory>
我已将 laravel 安装到 /var/www/html/stellar 文件夹中,现在我可以通过以下方式访问我的安装:
http://52.39.175.55/stellar/public/
但是在调用路由时它不起作用,喜欢
http://52.39.175.55/stellar/public/oauth/token
但假设我通过这个调用:
http://52.39.175.55/stellar/public/index.php/oauth/token
我得到了访问权限,
我尝试将我的public/.htaccess 文件更改为如下内容:
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase /stellar
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
还是没有变化,帮帮我吧。
【问题讨论】:
-
你启用了 mod_rewrite 吗?运行
sudo a2enmod rewrite -
@Troyer 我该如何检查?这是我完整的 php 信息52.39.175.55/info.php
-
Mod_rewrite 在 phpinfo() 中不可见。您可以通过以下方式查询:
apache2ctl -M -
@Troyer 我做到了,但这对我没有帮助。我可以看到
rewrite_module (shared)在输入apache2ctl -M时可用。
标签: apache laravel .htaccess ubuntu-server