I have a symlink mysite in my /srv/http/ folder pointing to /home/some-user/somefolder.
In my /etc/httpd/conf/httpd.conf, according to many thread in this site and other forums all around the Internet, I set the following:
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
DocumentRoot "/srv/http"
<Directory "/srv/http">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
Then I changed permission to 777 recursively to my symlink target folder like this:
chmod 777 -R /home/some-user/some-folder
But if I open my webbrowser and enter http://localhost/mysite/mypage.php I get the following error:
Access forbidden!
You don't have permission to access the requested object. It is either read-protected or not readable by the server.
If you think this is a server error, please contact the webmaster.
Error 403
localhost
Apache/2.4.9 (Unix) PHP/5.5.14
I've read many articles saying to do so, but I still can get it working...
You should chmod o+x the entire path where apache'd go through.
So in your case:
sudo chmod o+x /home/
sudo chmod o+x /home/some-user/
sudo chmod o+x /home/some-user/somefolder
Ok, found out! I needed also chmod o+x /home/some-user (parent folder to my site folder)
Related
As title said, I got error 403 (title of page) on Laravel project. Locally, it's working, but when I'm trying to put it live, on a web-host/my domain it gives me:
Forbidden
You don't have permission to access / on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
I deleted .htaccess file from public folder, and nothing happened.
Any solutions?
Your .htaccess is not parsed by apache because AllowOverride All directive is missing inside virtualhost configuration. .htaccess file is required for Laravel. Put back it. Then change apache virtual host configuration on server to allow .htaccess.
<VirtualHost *:80>
ServerName www.example.net
DocumentRoot "/var/www/html/example3"
<Directory /var/www/html/example3>
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Change your virtualhost like this and restart apache by sudo service apache2 restart.
Replace www.example.net and /var/www/html/example3 with correct details.
If you are using your own Request, change the authorize function to return true:
public function authorize()
{
return true;
}
As simple as that!
You can try these commands.
sudo chmod -R gu+w project_folder
sudo chmod -R guo+w project_folder
chmod -R 775 storage/
chmod -R 775 bootstrap/cache
I'm having some issues with permissions when it comes to symbolic links on my apache2 webserver. I originally had a data/ in /var/www , but was it getting too large for the directory and I kept getting a partition full warning. I'd like to move the data/ folder to /home/processor/Documents/sandbox/www_data/
I moved all the data to www_data and created a symbolic link in /var/www
ln -s /home/processor/Documents/sandbox/www_data data
Checking the link:
:/var/www$ ls -l data
lrwxrwxrwx 1 processor processor 43 Mar 16 17:03 data -> /home/processor/Documents/sandbox/www_data/
An example of the data shows that all permissions seem reasonable to me:
:/var/www$ ls -l data/2/15/2015/8/25/10/54/wf/2_15_2015_8_25_10_54_11*
-rwxrwxrwx 1 processor processor 475643 Mar 16 16:58 data/2/15/2015/8/25/10/54/wf/2_15_2015_8_25_10_54_11.png
-rwxrwxrwx 1 processor processor 53539 Mar 16 16:58 data/2/15/2015/8/25/10/54/wf/2_15_2015_8_25_10_54_11_thumb.png
This is whats in between the <VirtualHost *:80> </VirtualHost> in my /etc/apache2/sites-available/000-default.conf:
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options FollowSymLinks Indexes MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
But when trying too access it from the site I get "Forbidden You don't have permission to access /data/2/15/2015/8/25/9/46/wf/2_15_2015_8_25_9_46_28.png on this server."
I've read through a bunch of threads and have chown www-data:www-data, I've chmod -R 777 everything, and changed my 000-default.conf to numerous varieties of the same thing, but nothing is working. I don't know where to go from here.
Any suggestions would be greatly appreciated.
Thanks
It has to do with the permissions of /home/processor. The entire path needs a certain degree of privileges and the home directory did not have them. The only thing that needed to be done was to allow access to read and execute
sudo chmod 755 /home/processor/
I have installed a virtual machine CentOS 6.6. I also installed Apache, PHP, MySQL with yum.
I changed my document root from /var/www/html to /www
so I edited my /etc/httpd/httpd.conf and changed these two lines:
DocumentRoot "/var/www/html"
<Directory "/var/www/html">
I restarted apache and it was okay.
The problem occurred when I tried to open http://192.168.199.90/phpinfo.php.
I got:
Forbidden
You don't have permission to access /phpinfo.php on this server.
I tried to disable SElinux in /etc/selinux/conf and change enforcing to disabled
I also tried this: chcon -v -R --type=httpd_sys_content_t /www/
And when I write ls -laZ /www, I have:
drw-rw-rw-. www www unconfined_u:object_r:httpd_sys_content_t:s0 .
dr-xr-xr-x. root root system_u:object_r:root_t:s0 ..
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 phpinfo.php
drw-rw-rw-. www www unconfined_u:object_r:httpd_sys_content_t:s0 sites
Thank you all , i resloved it,
I changed the Current mode of SElinux
from enforcing to permissive by wrinting in the terminal :
setenforce 0
so when i write
getenforce i get Permissive
I did also chmod 755 -Rf /www
;)
Edit httpd.conf file, which is in /etc/httpd/conf/httpd.conf. Add the below code.
<Directory "/var/www/html">
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride None
Allow from all
</Directory>
Try:
chown -R apache:apache /www
or
chown -R www-data:www-data /www
BTW, never disable your SElinux
Just backed up a site to my local computer using CPanel.
I unzipped the file then placed it in /var/www.
Now my problem is that when I try to access HTML/PHP files from the public_html folder for the site via a browser (localhost/ndovucard/public_html/modules/contact_us.php), I get the 403 Forbidden Error by Apache2 server, and yes I did sudo chmod 755 /var/www.
Thanks.
There are can be several reasons why you are getting **403 Forbidden Error **
First check out weather you are denying permission to an .htaccess file and
that your apache2 is configured to allow htaccess file overide.
Check out your apache2 sites-available by using this command
in order to make your .htaccess files ( if you have any) work as expected, you need to edit this file:
sudo gedit /etc/apache2/sites-available/default
and then Look for a section that looks like this:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None // change **`None`** to **`All`**
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/
</Directory>
. You need to reload Apache in order this change to have an effect:
sudo /etc/init.d/apache2 reload
OR
sudo service apache2 restart
If that is not the case, you have have permission set not correctly as you have said .
sudo chmod 775 /var/www/yourProjectFolderHer* -R
Hope that may help
sudo chmod 755 -R /var/www
and show your /var/log/
I'm facing to a problem I didn't have before.
I have my local LAMP server root folder in /home/franck/www
I managed to do so to seperate my working flow from the system, just in case and also because this is how most servers I'm working with are setup.
What I did :
sudo chown -R www-data:www-data ~/www
sudo usermod -a -G www-data franck
sudo chmod -R ug+rwx ~/www
I didn't have this permission error before. I just updated php5 to 5.5 via ppa, don't know if it's the reason. I'm still having 403 error permission.
Could someone help ?
<VirtualHost ....>
ServerAdmin neovea#gmail.com
ServerName dev.atomik.me
ServerAlias dev.atomik.me
DocumentRoot /home/franck/www/atomik
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /home/franck/www/atomik/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
All right ! I found the solution !
I really don't know why it now works this way, but after googleing and stacking a bit more ahead, it appears that files in sites-available must be named *.conf before being enabled.
I did so, deleted my files in sites-enabled and enabled it again. Worked perfectly.
But I'm still wondering why I didn't have to do so before, and now I do... Mystery. Maybe an update from Apache2 ?
If someone know, I'm really interested. So after all my permissions were right. I hope that'll help.
Thanks a lot for the hand ;)