Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #226591

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

From Gary Dale <gary@extremeground.com>
Newsgroups linux.debian.user
Subject Re: Why can't I move the document root for a site in Apache 2? [SOLVED]
Date 2020-08-31 23:00 +0200
Message-ID <AJZ4e-2cf-5@gated-at.bofh.it> (permalink)
References <AJynn-2YJ-1@gated-at.bofh.it> <AJz05-3rm-5@gated-at.bofh.it> <AJzjr-3xE-3@gated-at.bofh.it> <AJXvs-1kZ-9@gated-at.bofh.it> <AJYhQ-1Sd-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 2020-08-31 15:59, Gary Dale wrote:
> On 2020-08-31 15:14, Gary Dale wrote:
>> On 2020-08-30 13:24, john doe wrote:
>>> 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.
>>>
>> OK. I had done that already. However I noticed that my AllowOverride 
>> was for "None" - the same as /var/www/. When I change it to All, I get
>>
>> Forbidden
>>
>> You don't have permission to access this resource.Server unable to 
>> read htaccess file, denying access to be safe
>> Apache/2.4.38 (Debian) Server at lionsclub.local Port 80
>>
>>
>> In fact I don't have a .htaccess file anywhere on my sites (as per 
>> Apache's recommendations). The AllowOverride directive apparently 
>> allows Apache to look for one, so the problem remains the same.
>>
>> In response to your first question, the permissions are u:rwx g:rwx 
>> o:rx. This is slightly looser than the folder in /var/www which 
>> removes g:w. In both cases the files are owned by me and group:www-data.
>>
>>
> OK. Found it. The folder containing all the sites needed to have the 
> www-data group. I'm not sure why, since my directory structure is 
> something like:
>
> /<folder in root>
>     /<folder that is exported>
>         /<folder containing all the web sites>
>             /<folder grouping sites>
>                 /<folder containing one site>
>                     /<folder containing site files>
>
> My document root for the site is the full tree. For testing, I used 
> the <folder containing one site> in the <Directory> directive. When I 
> changed the group ownership on the folder above it, things started 
> working. However the <folder that is exported> still has the old 
> permissions...
>
> The reason I do things this way is that I work on the sites locally in 
> place - so my site/project folder contains all the files for that 
> site/project, while the files that are needed on the public site 
> reside in a single folder below the <folder containing one site> 
> (which usually contains multiple subfolders).
>
> Thanks John!
>
Just to be clear, the folder I had to change permissions on is the 
<folder containing all the web sites. This is many levels above the 
document root,

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Why can't I move the document root for a site in Apache 2? Gary Dale <gary@extremeground.com> - 2020-08-30 18:30 +0200
  Re: Why can't I move the document root for a site in Apache 2? john doe <johndoe65534@mail.com> - 2020-08-30 19:10 +0200
    Re: Why can't I move the document root for a site in Apache 2? john doe <johndoe65534@mail.com> - 2020-08-30 19:30 +0200
      Re: Why can't I move the document root for a site in Apache 2? Gary Dale <gary@extremeground.com> - 2020-08-31 21:20 +0200
        Re: Why can't I move the document root for a site in Apache 2?  [SOLVED] Gary Dale <gary@extremeground.com> - 2020-08-31 22:10 +0200
          Re: Why can't I move the document root for a site in Apache 2?  [SOLVED] Gary Dale <gary@extremeground.com> - 2020-08-31 23:00 +0200
            Re: Why can't I move the document root for a site in Apache 2?  [SOLVED] mick crane <mick.crane@gmail.com> - 2020-09-01 07:50 +0200
            Re: Why can't I move the document root for a site in Apache 2?  [SOLVED] <tomas@tuxteam.de> - 2020-09-01 10:40 +0200
              folders (was Re: Why can't I move the document root for a site in  Apache 2? [SOLVED]) The Wanderer <wanderer@fastmail.fm> - 2020-09-01 12:50 +0200
                Re: folders (was Re: Why can't I move the document root for a site  in Apache 2? [SOLVED]) <tomas@tuxteam.de> - 2020-09-01 16:00 +0200
                Re: folders (was Re: Why can't I move the document root for a site  in Apache 2? [SOLVED]) Andrei POPESCU <andreimpopescu@gmail.com> - 2020-09-02 11:50 +0200
                Re: folders (was Re: Why can't I move the document root for a site  in Apache 2? [SOLVED]) <tomas@tuxteam.de> - 2020-09-02 12:00 +0200
                Re: folders (was Re: Why can't I move the document root for a site  in Apache 2? [SOLVED]) Marek Mosiewicz <marek.mosiewicz@jotel.com.pl> - 2020-09-01 21:10 +0200
              Re: Why can't I move the document root for a site in Apache 2?  [SOLVED] Greg Wooledge <wooledg@eeg.ccf.org> - 2020-09-01 14:10 +0200
                Re: Why can't I move the document root for a site in Apache 2?  [SOLVED] Greg Wooledge <wooledg@eeg.ccf.org> - 2020-09-01 15:40 +0200
                Re: Why can't I move the document root for a site in Apache 2? [SOLVED] Kenneth Parker <sea7kenp@gmail.com> - 2020-09-01 16:10 +0200
                Re: Why can't I move the document root for a site in Apache 2? [SOLVED] Kenneth Parker <sea7kenp@gmail.com> - 2020-09-01 15:40 +0200
                Folders [was: Why can't I move the document root for a site in  Apache 2? [SOLVED]] <tomas@tuxteam.de> - 2020-09-01 16:00 +0200
              Re: Why can't I move the document root for a site in Apache 2?  [SOLVED] elvis <elvis@dogonfire.com> - 2020-09-01 15:10 +0200
                Re: Why can't I move the document root for a site in Apache 2?  [SOLVED] Dan Ritter <dsr@randomstring.org> - 2020-09-01 15:40 +0200
                Re: Why can't I move the document root for a site in Apache 2?  [SOLVED] <tomas@tuxteam.de> - 2020-09-01 16:10 +0200
                Re: Why can't I move the document root for a site in Apache 2?  [SOLVED] Greg Wooledge <wooledg@eeg.ccf.org> - 2020-09-01 16:40 +0200
                Re: Why can't I move the document root for a site in Apache 2?  [SOLVED] <tomas@tuxteam.de> - 2020-09-01 16:50 +0200
              Re: Why can't I move the document root for a site in Apache 2? [SOLVED] rhkramer@gmail.com - 2020-09-01 16:10 +0200
                Re: Why can't I move the document root for a site in Apache 2?  [SOLVED] <tomas@tuxteam.de> - 2020-09-01 16:20 +0200
                Re: Why can't I move the document root for a site in Apache 2?  [SOLVED] John Crawley <john@bunsenlabs.org> - 2020-09-02 02:30 +0200

csiph-web