403 Forbidden Error when accessing file - httpd 2.4.23 - apache

I've installed HTTPD and PHP7 on my Fedora 24 64 bits. When i use the default path for 'DocumentRoot' ('/var/www/html') in the '/etc/httpd/conf/httpd.conf' file everything works perfectly but when I change the path to '/home/beto/web' it stops working.
When I try to access to 'localhost' the 'Fedora Test Page' with the non-default path works but if I try to access to any file, 'localhost/info.php' or 'localhost/foo.html' for example, it says:
403 Forbidden You don't have permission to access /info.php on this server.
I've checked the permissions with this 'namei -m /home/beto/web/info.php and this is the output:
dr-xr-xr-x /
drwxr-xr-x home
drwxr-xr-x beto
drwxr-xr-x web
-rw-rw-r-- info.php
I've been trying for a while :'(

Related

pi raspbian buster apache2 www-data forbidden on different directory 2021

I have searched for recent posts on this, and older ones do not fix the issue.
I have Rasbian Buster (2021) on a pi4. Apache2.
The default /var/www/html works
trying to move it to a hdd /media/pi/Data/www/html fails
I have given it www-data user and group permissions for all folders.
I have checked that it has this in GUI and console.
Looking at the permissions on /var/www/html they are ROOT when apache2 is installed and this site works. BUT all documents say it should be www-data. Ihave not tried changing it as it will probably break it and is my reference.
I have checked that apache2 envars APACHE_RUN_USER = www-data and APACHE_RUN_GROUP=www-data
So why does it install /var/www/html as ROOT but all documents (rightly) say www-data should have permissions then it still not work?
For example I followed https://pimylifeup.com/raspberry-pi-apache/ and logged ou etc and it still fails ith Forbidden :Yu dn'thave permission to access this resource.
There seem to be varying ways to fix it, but not so only www-data has access, and I shouldn't need ROOT to have it as its very bad practice...so why does the default site have it?!
Wht is the correct fix to use adifferent directory for the website (eventualy it will be webdav but one simple step at a time!)
Thank you

Permission denied error when creating cache folder - Apache httpd

I am using Apache HTTPD with the Dispatcher module running on RHEL.
The dispatcher works fine but it's unable to cache the file. On inspecting the logs I see the following error -
Unable to create parent directory /var/www/html/bla/bla/static: Permission denied
My apache is running with the default user and usergroup - apache
I have also changed the ownership of my docroot (/var/www/html) to apache.
drwxrwxrwx. 20 apache apache 278 Jun 14 04:08 var
Does anyone know what the problem is? Please help!

Apache2 relative paths not working

Good Morning,
I am currently setting up and apache2 server on my raspberry pi. My index.html file is in the directory /var/www/html and the file is loading fine when I go to the IP address. However, the images located in /var/www/html/img are not loading. The html is like this: <img alt="image1" src="img/picture1.png">. When I right click on the alternative image icon, and select open image in new tab, I get:
You don't have permission to access /img/picture1.png on this server.
Server unable to read htaccess file, denying access to be safe
How can I prevent this and make the user able to access the image?
Many thanks,
Try
chmod -R 755 /img/
this will set the permission for all files in the folder readable and executable for all, and also writable by the owner.
The output will be in the form
-rwxr-xr-x 1 root root 0 Apr 5 12:38 picture1.jpg

apache2 running root despite defined to www-data in envvars

My server seems to run apache2 as root despite set to www-data in /etc/apache2/envvars.
How can this happen ?
/etc/apache2/envvars
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
Here is how I checked it
How do I figure out what user & group Apache is running as?
ps axo user,group,comm | grep apache
root root apache2
root root apache2
root root apache2
root root apache2
root root apache2
root root apache2
root root apache2
I think that APACHE_RUN_USER is supposed to be the user that apache2 uses to read, write, or execute the files in your website. Not the user that runs the apache2 server. You wouldn't want your server running webpages as root, because files you may want to keep the user from accessing will become visible. I may be wrong though. Try running service apache2 restart, and checking again.

How to set permissions so Zend Server CE Virtual Host can access a document root under my /Users/me directory on a mac

I am trying to set up Zend Server CE Virtual Host on a Mac running OSX Snow Leopard.
If I put the vhost document root in
/usr/local/zend/apache2/vhosts/site
everything works fine.
If I put it into
/Users/me/Documents/site
I get:
"Forbidden You don't have permission to access / on this server."
The permissions for /Users/me/Documents/site are:
drwxrwxrwx 3 me staff 102 30 Jul 12:33 test
How can I get the zend server daemon to serve files in my Documents directory?