0

I have apache2 setup and serving files successfully from locations such as:

/var/www/example.com

where ownership and permissions were set like this:

sudo chown -R $USER:$USER /var/www/example.com

sudo chmod -R 755 /var/www

resulting permissions look like:

drwxr-xr-x 6 tim tim 4096 Aug 23 23:22 example.com/

drwxr-xr-x 5 tim tim 4096 Aug 24 14:45 www/

and apache2.conf includes:

ServerName 127.0.0.1

and hosts includes

127.0.0.1 localhost

sudo service apache2 restart

a browser successfully loads:

localhost/example.com


the above is all good but...

I get 403s when I attempt to setup files to be served from an ntfs partition with:

sudo gedit /etc/fstab

/dev/sda3 /media/tim/Data ntfs-3g permissions,locale=en_GB.utf8 0 2

sudo umount /media/tim/Data

sudo mount -a

and use the same chown and chmod method above:

sudo chown -R $USER:$USER /media/tim/Data/www/example.com

sudo chmod -R 755 /media/tim/Data/www

with a symbolic link such as:

/var/www/ $ ln -s /media/tim/Data/www/example.com

The symbolic link works with these permissions: lrwxrwxrwx 1 tim tim 36 Aug 24 14:45 example.com -> /media/tim/Data/www/example.com

and the permissions for the folders look like this:

drwxr-xr-x 1 tim tim 8192 Aug 24 15:16 /media/tim/Data/www/example.com

drwxr-xr-x 1 tim tim 0 Aug 23 23:24 /media/tim/Data/www/


i have also tried

setting up virtualhost successfully on the local ext4 file system, but again got 403s if the virtualhost pointed to /media/tim/Data/www/example.com or the symbolic link /var/www/example.com

I've seen others apparently solve the issue with the fstab method, and as far as I can tell my permissions are also set correctly this way, but still fails.

Answers appreciated.

timoto
  • 1
  • 2

1 Answers1

0

I found my answer: here

I saw many apparently found a way to use /media/ as the method of mounting and pointing to, but I was not able to do this successfully with my internal ntfs partition.

The solution was to mount the ntfs partition to a subdirectory of /mnt/ and give that sub directory the necessary permissions.

cd /mnt
sudo mkdir Data
sudo chown tim:tim Data
sudo chmod 755 Data

then

sudo gedit /etc/fstab adding the line:

/dev/sda3 /mnt/Data ntfs-3g auto,users,uid=tim,gid=tim,utf8,dmask=002,fmask=113 0 0

and

sudo gedit /etc/apache2/sites-available/default with:

DocumentRoot /mnt/Data/www

and

sudo gedit /etc/apache2/sites-available/example.com with:

DocumentRoot /mnt/Data/www/example.com

Using this method apache2 can now serve a site from an ntfs partition.

timoto
  • 1
  • 2