setting document root in antoher partition on ubun

2019-06-02 06:19发布

i would like to place my apache document root inside another partition of my ubuntu hard drive, but i keep getting forbidden message, when i place to my home directory it woking find, how could that be? is the group or owner affected ? here mysite.conf and apache2.conf when i place my document root in my home folder (Working)

#site-available/mysite.conf
DocumentRoot /home/jono/www

#/etc/apache2/apache2.conf
<Directory /home/jono/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

bu when i change document root to another partition i keep getting forbidden messasge

#site-available/mysite.conf
DocumentRoot /media/jono/website_data/www

#/etc/apache2/apache2.conf
<Directory /media/jono/website_data/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

is the owner/group access affected ? or there is another problem ?

2条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-06-02 06:56

As a quick workaround (safe and quick) you can make the mounting point of your external hard driver to the default root directory ( /var/www by default).

Assigning the mounting point to a per-existing directory is safe but the old content can't be reached unless you unmounted the driver.

To learn more how to create a mounting point refer to this. To know more about assigning the mounting point to a per-existing directory refer to this.

查看更多
▲ chillily
3楼-- · 2019-06-02 07:15

at last it's working, i have to grant all access to www:data for accesing whole directory thanks to you @mark-b, using chown -R www-data:www-data to whole directory isn't good idea but for local development is ok i guest

查看更多
登录 后发表回答