簡體   English   中英

在Apache中收到404錯誤-Cakephp 3生產后端

[英]Receiving 404 Error in Apache - Cakephp 3 Backend on Production

使用Cakephp 3路由來設置以下路由

$routes->post(
    '/auth/login/*',
    ['controller' => 'WvUser', 'action' => 'login']
);

$routes->post(
    '/auth/signup/*',
    ['controller' => 'WvUser', 'action' => 'signup']
);

這在本地服務器上運行非常好,現在我在網頁上收到404錯誤。

這是新安裝的apache,在/etc/apache2/apache2.conf了少量更改

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

試圖創建一個臨時的新Cakephp項目,該項目也面臨類似的問題,我的項目和新的臨時蛋糕框架都具有相似的.htaccess文件

在/ var / www / project里面

# Uncomment the following to prevent the httpoxy vulnerability
# See: https://httpoxy.org/
#<IfModule mod_headers.c>
#    RequestHeader unset Proxy
#</IfModule>

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule    ^(\.well-known/.*)$ $1 [L]
    RewriteRule    ^$    webroot/    [L]
    RewriteRule    (.*) webroot/$1    [L]
</IfModule>

在/ var / www / project / webroot

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

/var/www/apache2/error.log中沒有錯誤。

聽起來您尚未在apache中啟用mod-rewrite。

對於Ubuntu:

sudo a2enmod rewrite
sudo systemctl restart apache2

由於其可選的(IfModule)apache不會產生錯誤。

在您同時檢查mb_string,intl和simplexml是否已安裝

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM