2

I'm trying to configure my local server, in the same way I always do but not working, says I have no excuses, but if I give the same permissions to the www folder remains the same and if I point to this folder www if it works I do not understand?

if I do it this way: it works

DocumentRoot /var/www
<Directory />
        Options FollowSymLinks
        AllowOverride None
</Directory>
<Directory /var/www>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
</Directory>

drwxr-xr-x  2 root root     4096 nov  6 15:27 www

but if I do this: does not work

DocumentRoot /home/diego/web_server
<Directory />
        Options FollowSymLinks
        AllowOverride None
</Directory>
<Directory /home/diego/web_server>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
</Directory>


drwxr-xr-x 2 root root 4096 mar  4 15:40 web_server 

I'm doing wrong?

user987055
  • 1,039
  • 4
  • 14
  • 25

1 Answers1

2

In Apache on Ubuntu 12.10 you should have an envars file in /etc/apache2/envars. The User:Group the web server is running as is set in envars. If you change documentroot you need to set permissions on that new doc root appropriately. Chances are in your environment your Apache2 instalation is running as www-data:www-data. If so you need to set permissions on the new docroot and any user that will write to that dir structure as well.

In /etc/apache2/apache2.conf you will find the following lines about half way down a the file.

#These need to be set in /etc/apache2/envars
    User ${APACHE_RUN_USER}
    Group ${APACHE_RUN_GROUP}

In /etc/apache2/envars you will find

export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data

You can either assign a different User:Group in envars or assign the directory permissions for www-data.

This is different than the way it used to be done within httpd.conf.

apesa
  • 12,163
  • 6
  • 38
  • 43
  • I do not understand, as it should be set then? Perform a clean install but I dont had this problem and unless this directory, look at the machine and do not have it, i can do something to not use it, as in the other machine? – user987055 Mar 04 '13 at 23:47
  • I am sorry, but I don't understand your comment. My answer is based on your OP above and your Vhost config. I am sure you have permission issue because of your non standard documentroot at /home/diego/web_server. These dir permissions are not set correctly. Since you're trying to use your home directory try adding your user to the www-data group and logging back on. – apesa Mar 04 '13 at 23:55
  • It works, i change export APACHE_RUN_USER=diego export APACHE_RUN_GROUP=diego, and chown diego:diego web_server/ -R, and /etc/init.d/apache2 restart – user987055 Mar 05 '13 at 00:01
  • yes, that's how it works. Just know that if diego is an admin like user with a wide amount of access then your Apache environment is not going to be secure if it is running as diego. In a production environment the Apache user:group should be restricted to just accessing the webserver and appropriate folders within. -Pat – apesa Mar 05 '13 at 14:28