[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Why can't I move the document root for a site in Apache 2?



On 8/30/2020 7:08 PM, john doe wrote:
On 8/30/2020 6:27 PM, Gary Dale wrote:
I'm running Apache 2.4.38-3+deb10u3 on a Debian/Stable server on an
AMD64 machine.

When I create a virtual host under /var/www, everything works as
expected. However, if I change the virtual host's document root to
another folder on the same machine, I get

|Forbidden You don't have permission to access this resource.
Apache/2.4.38 (Debian) Server at <servername>.local Port 80 |

where I use .local instead of the live site's actual TLD to refer to my
local server.

I get the same thing if I replace the public_html folder with a link to
the other folder. To be clear, the folder and files in it are owned by
the same account & group. And I can cd to the other folder through the
link, so it's working.

Also to be clear, when I go to <servername>.local with the site in
/var/www/<servername>.local/public_html, it works.

A reason I want to move the sites is that /var is in my system
partition, which runs off of a small SSD, while the other folder in on a
RAID-6 array with lots of space.

When I search for the problem, I see a lot of "solutions" that say just
change the document root of the vhost and restart Apache 2. However that
isn't working in my case. This is likely Debian specific but all the
Debian stuff only shows vhosts under /var/www, which isn't what I want.

Any ideas?



What are the permissions of the directory in question?

Do you have a directory directive for that location in apache2?

--
John Doe


That is, if you change the 'DocumentRoot' directive you also need to
modify or add a corresponding directory directive in apache2.
Look at '/etc/apache2/apache2.conf' for how it is done for '/var/www'.:

"<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>"

I would change the path of '<directory ...' to whatever your
DocumentRoot directive is pointing to.

--
John Doe


Reply to: