![Apache2 - 404 错误 - 将 php 文件从 Windows 迁移到 Ubuntu 时遇到错误](https://linux22.com/image/609971/Apache2%20-%20404%20%E9%94%99%E8%AF%AF%20-%20%E5%B0%86%20php%20%E6%96%87%E4%BB%B6%E4%BB%8E%20Windows%20%E8%BF%81%E7%A7%BB%E5%88%B0%20Ubuntu%20%E6%97%B6%E9%81%87%E5%88%B0%E9%94%99%E8%AF%AF.png)
我找不到任何错误。
附录00-默认
AccessFileName .htaccess
Alias /api "/var/www/AppServices/public"
Alias /server_api "/var/www/AppServices/Server_API"
Alias /client_api "/var/www/AppServices/Client_API"
Alias /secure_api "/var/www/AppServices/Secure_API"
Listen 8002
<VirtualHost *:8002>
DocumentRoot /var/www/AppServices/public
ServerName .local
# This should be omitted in the production environment
SetEnv APPLICATION_ENV development
<Directory "/var/www/AppServices/public">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d [OR]
RewriteCond %{REQUEST_FILENAME} !-s [OR]
RewriteRule ^(.*)$ index.php?request=$1 [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*)$ index.php [NC,L]
RewriteCond %{REQUEST_FILENAME} -s
RewriteRule ^(.*)$ index.php [NC,L]
</IfModule>
.index.php 位于该文件夹下。
/var/www/AppServices/Server_API$ ls
. .. admin.php .htaccess index.php infor.php message.php
当我将 JSON POST 到此 URL 时
xxx.xxx.xxx.xxx:8002/server_api/消息
我收到 404 错误:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /var/www/AppServices/Server_API/index.php was not found on this server.</p>
<hr>
<address>Apache/2.2.22 (Ubuntu) Server at xxx.xxx.xxx.xxx Port 8002</address>
</body></html>
看起来同一文件夹下的 .htaccess 文件正在运行。它翻译 url“http://xxx.xxx.xxx.xxx:8002/server_api/消息“ 到 ”http://xxx.xxx.xxx.xxx:8002/server_api/index.php?request=message“。但是apache2无法找到同一文件夹中的index.php。
- 编辑 -
在 Apache2 error.log 中:
[2013 年 4 月 14 日星期日 21:08:17] [错误] [客户端 127.0.0.1] 文件不存在:/var/www/AppServices/public/var
public 文件夹中没有 var。但是为什么呢???