Is there a limitation on the directory name "php"?

The fact is that if I try to access the project file via the Internet by entering the address of the site / php / ? I will get an error 403, if I access the files at the same address but stored in a directory with a different name (for example, the site address / page / ), they will be shown to me. I can access the php directory from other files via include ().

No restrictions in httpd.conf found, but .htaccess in the project is missing

  • 403 is an access error. Most likely, there is no rights to the folder at the web server. - ilyaplot
  • Do not tell me where these settings can be found? - nita
  • Again, there is no prohibition in httpd.conf, and htaccess is missing. No other configuration files are used on the server - nita
  • permissions to read each file and permissions to read a list of files in a directory are different things. When you call example.com/php/ do you want the list of files in the directory to be shown? or do you have any call example.com/php/test.php ends with a 403 error? - teran
  • @ilyaplot wouldn’t work then with the inclusion. - teran

1 answer 1

I list the algorithm for launching the site, check each stage on your server. You need to edit the access rights to make sure that read access is allowed to the shared web directory and all files and folders contained in it. This is necessary to ensure that the pages of the site are displayed correctly:

 sudo chmod -R 755 /var/www 

Your web server should now have the permissions necessary to display content. In addition, now your user has the ability to create content in the necessary directories.

Check if you have created the file:

/etc/apache2/sites-available/example.com.conf

 <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> 

Include site:

 sudo a2ensite example.com.conf 

and reboot the server:

 sudo service apache2 restart 
  • one
    I do not understand how this will help to allow access to the directory? - nita
  • @nita for starters, look at what rights are displayed in your directory, the username fulfilling the request, if everything matches, it should work (plus what is in the answer), do not correct (as in the answer) - Shilgen
  • I have Apache on Windows 7, the virtual host is registered just like you, a hint at denying access specifically to the "php" directory in the settings was not found. If there was no access to the project, then, probably, there would be no access to the other directories, but they are quite accessible to themselves - nita
  • @nita is sometimes reserved when copying or unpacking, so I would not neglect this check. - Shilgen