www-data read user home folder

www-data is apache2 user

ub is my user

and you want save your server home folder ex: /home/ub/websites

# make dir with reqursive for websites and logs
$ mkdir -p ~/websites/logs
#fix your 000-default file
$ sudo nano /etc/apache2/sites-enabled/000-default
<VirtualHost *:80>
ServerAdmin webmaster@localhost

DocumentRoot /home/ub/websites
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /home/ub/websites/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

LogLevel info
ErrorLog /home/ub/websites/logs/error_ub
CustomLog /home/ub/websites/logs/custom_ub combined

RewriteEngine On
RewriteLog /home/ub/websites/logs/rewrite_ub
RewriteLogLevel 0

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>
# add user to www-data group
$ sudo adduser $USER www-data

# change owner websites folder to ub:www-data
$ sudo chown -R "$USER":www-data /home/ub/websites

# restart apache
$ sudo service apache2 restart

Published by

G3n1k

just to remember what i had known :)

One thought on “www-data read user home folder”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s