Adding a Shared folder also as Document Root

803 Views Asked by At

I am running Apache 2.4.41 on Linux Mint 20. My document root is home/www/. I have a laptop also connected using Samba. I would like to add a shared folder also (from the laptop) to the Document Root settings.

How do I do it without removing home/www/?

1

There are 1 best solutions below

1
Nic3500 On
  1. On your laptop, enable sharing of a folder. Lets say C:\LinuxShare.
  2. On mint, install Samba to mount that folder. Mount it on /mnt/LinuxShare.

When that works...

  1. Identify the user running your Apache. You can start is and do ps -ef | grep httpd, it will show you the user. Or look in httpd.conf, directive User.
  2. Configure the permissions on /mnt/LinuxShare so that the user identified in 3) can read files under that directory. You could use a group, or others permissions (for home it's ok, for corporate network, do not use others!).

When you have validated that the Apache user can read files under /mnt/LinuxShare

  1. In your VirtualHost, add Alias /wwwpc /mnt/LinuxShare
  2. Also add a <Directory /mnt/LinuxShare> section to allow reading that directory.

Restart Apache

  1. on the laptop, put an HTML file (lets say SOMEPAGE.html) in C:\LinuxShare. Make sure you can see it on mint under /mnt/LinuxShare.
  2. on mint, start a browser and try http://localhost/wwwpc/SOMEPAGE.html. You should see the page.
  3. on the laptop, start a browser and try http://THE_IP_OF_THE_MINT/wwwpc/SOMEPAGE.html. Remember that Apache runs on mint, so on the laptop you cannot access it via localhost.