0

On my ubuntu server i have user farmer inside home/farmer directory i created directories /var/www/html/ and inside html i put file index.html

I have granted following rights to directories and index.html file

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 

I installed Apache2 on ubuntu and inside directory /etc/apache2/sites-available created config file test.conf with following instructions

<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>

In /etc/apache2/apache2.conf I created additional Directory instruction

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

After configuration i tried to access my test.html i run curl http://64.227.17.11/test.html but response is 404 not found error but when i run curl http://64.227.17.11/ i see sratus 200 what can be a problem that apache don't find test.html inside /var/www/html ?

In var/log/apache2/error.log following output

[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

0

You must log in to answer this question.

Browse other questions tagged .