Apache2 404 未找到文件夹中实际存在的文件错误

Apache2 404 未找到文件夹中实际存在的文件错误

在我的 ubuntu 服务器上我有用户农民里面家庭/农民目录我创建了目录 /var/www/html/ 并在 html 里面放置了文件 index.html

我已授予目录和 index.html 文件以下权限

drwxrwxr-x 3 farmer www-data 4096 Mar  1 13:26 var
drwxrwxr-x 3 farmer www-data 4096 Mar  1 13:26 www
drwxrwxr-x 2 farmer www-data 4096 Mar  1 14:00 html
-rw-r--r-- 1 farmer www-data 501 Mar  1 14:00 test.html 

我在 ubuntu 上安装了 Apache2,并在目录 /etc/apache2/sites-available 中创建了配置文件 test.conf,具体说明如下

<VirtualHost *:80>                                        
   ServerAdmin [email protected]                     
   DocumentRoot /var/www/html                             
   ServerName 64.227.177.11
   ServerAlias www.64.227.177.11

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

ErrorLog 
  ${APACHE_LOG_DIR}/error.log
CustomLog 
  ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

在 /等/apache2/apache2.conf 我创建了额外的目录指令

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

配置完成后,我尝试访问我的 test.html,我运行 curlhttp://64.227.17.11/test.html但响应是 404 未找到错误,但是当我运行 curlhttp://64.227.17.11/我看到 sratus 200 apache 在 /var/www/html 中找不到 test.html 可能是什么问题?

在 var/log/apache2/error.log 中输出以下信息

[Fri Mar 01 16:23:38.573276 2024] 
[core:notice] [pid 2429593] AH00094: 
Command line: '/usr/sbin/apache2'
[Fri Mar 01 16:23:38.573283 2024] 
[core:debug] [pid 2429593] log.c(1570): AH02639: Using SO_REUSEPORT: yes (1)
[Fri Mar 01 16:23:38.573289 2024] [mpm_prefork:debug] [pid 2429593] prefork.c(970): AH00165: Accept mutex: none (default: pthread)
[Fri Mar 01 16:23:38.573641 2024] [watchdog:debug] [pid 2429595] mod_watchdog.c(559): AH02980: Watchdog: nothing configured?
[Fri Mar 01 16:23:38.574241 2024] [watchdog:debug] [pid 2429596] mod_watchdog.c(559): AH02980: Watchdog: nothing configured?
[Fri Mar 01 16:23:38.581594 2024] [watchdog:debug] [pid 2429598] mod_watchdog.c(559): AH02980: Watchdog: nothing configured?
[Fri Mar 01 16:23:38.582444 2024] [watchdog:debug] [pid 2429597] mod_watchdog.c(559): AH02980: Watchdog: nothing configured?
[Fri Mar 01 16:23:55.379220 2024] [authz_core:debug] [pid 2429594] mod_authz_core.c(815): [client 64.227.17.11:35816] AH01626: authorization result of Require all granted: granted
[Fri Mar 01 16:23:55.379334 2024] [authz_core:debug] [pid 2429594] mod_authz_core.c(815): [client 64.227.17.11:35816] AH01626: authorization result of <RequireAny>: granted
[Fri Mar 01 16:23:55.379445 2024] [core:info] [pid 2429594] [client 64.227.17.11:35816] AH00128: File does not exist: /var/www/html/test.html

相关内容