F
F
Fetur2016-04-16 15:04:56
linux
Fetur, 2016-04-16 15:04:56

How to make apache2 execute files?

I decided to try to work on ubuntu. remembering the experience of Denver, and even a self-made server on apache2, how easy everything is and just having read on all sorts of forums "lamp is not a crutch in the form of Denver, everything is cooler here" I was ambushed. What we have:
Given:
Ubuntu 14.0.4 LTS
It has a LAMP server, there are two symlinks in the /var/www folder

dev1.com -> /home/fetur/lamp-server/dev1.com
dev.com -> /home/fetur/lamp-server/dev.com

Permissions are set normally
sudo chown -R $USER:$USER /var/www/dev.com/public
sudo chown -R $USER:$USER /var/www/dev1.com/public
sudo chmod -R 755 /var/www

And now the question is why everything works only with newly created files, in particular, this applies to index.html, but not with ready ones.
I displayed the rights of these files in the console index.html - ready file, index2.html - just created in this folder
drwxrwxr-x 6 fetur fetur 4096 апр.  16 14:41 .
drwxrwxr-x 3 fetur fetur 4096 апр.  16 14:37 ..
drwx------ 2 fetur fetur 4096 июля  21  2015 css
drwx------ 2 fetur fetur 4096 июля  21  2015 fonts
drwx------ 2 fetur fetur 4096 июля  22  2015 img
-rw-rw-r-- 1 fetur fetur   21 апр.  16 14:38 index2.html
-rw------- 1 fetur fetur 7681 июля  22  2015 index.html
-rw-rw-r-- 1 fetur fetur    0 апр.  16 14:38 index.html~
drwx------ 2 fetur fetur 4096 июля  21  2015 js

In principle, I myself see that there is a difference in rights, but if they simply add rights through the terminal, then this does not solve the problem. Throws out in the browser.
Forbidden
You don't have permission to access /index.html on this server.
Apache/2.4.7 (Ubuntu) Server at dev.com Port 80

How to make apache2 work as I need? So I just threw the files and that's it.
PS> At the same time, it confuses me to work in the /var system directory, is it the same? I tried to transfer /var/www to the /home/fetur/lamp-server folder, but hello
Forbidden
You don't have permission to access / this server.
Apache/2.4.7 (Ubuntu) Server at dev.com Port 80

Having found out that the problem is as old as the world, I did not climb deeply, but I met this error as early as 2009, but did not find a clear answer on how to fix it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Selivanov, 2016-04-16
@Fetur

Apache apparently does not run as the user fetur, but as its own user, in ubuntu it is www-data. The permissions -rw------- fetur fetur mean that the user fetur can rw-, the group fetur can ---(nothing), and all other users, including www-data, can ---(nothing).
The rights to the new files are determined by umask, I advise you to read about it. (And also the default acl of the parent folder, but you do not use acl).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question