【发布时间】:2019-09-29 16:35:54
【问题描述】:
我正在使用 ubuntu 16.04 在 Digital Ocean 上部署我的第一个 yii2 api。我对 API 发出的所有请求都收到 404 not found 响应。同样的 API 在本地运行良好,没有任何问题。
我已经设置好 LAMPP 并将我的数据库链接到我的 API, 我已经在域中安装了 SSL 证书,效果很好。 当我按如下方式托管 API 时; /var/www/html/myfolder/api/....
没有请求在这个 API 上起作用,例如
https://example.com/myfolder/api/web/v1/beforeauths/trending
我在 .../api/web 中有一个 .htaccess,它具有以下规则
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
我在 ../api 文件夹中也有一个 .htaccess,其中包含以下内容
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ web/$1 [L]
</IfModule>
# Deny accessing below extensions
<Files ~ "(.json|.lock|.git)">
Order allow,deny
Deny from all
</Files>
# Deny accessing dot files
RewriteRule (^\.|/\.) - [F]
我不知道我的配置中肯定错过了什么。对此的任何帮助都会很棒
【问题讨论】:
-
您确定在您的 Apache 配置中启用了重写模块吗?
-
请问我该怎么做???因为我不记得这样做了
标签: yii2 ubuntu-16.04 digital-ocean yii2-advanced-app