簡體   English   中英

在apache2中更改根目錄給出403禁止錯誤

[英]Changing root directory in apache2 is giving 403 Forbidden error

盡管這里有很多類似的問題,但是我無法從中解決我的問題。 我已經在ubuntu(14.04)安裝了Apache/2.4.7 (Ubuntu) ubuntu(14.04) 我已經更改了兩個配置文件,將apache的默認DocumentRoot更改為/var/www/home/name/www 我更改的文件是/etc/apache2/apache2.conf/etc/apache2/sites-available/000-default.conf apache2.conf我把

<Directory /home/name/www>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

000-default.conf我進行了更改,

DocumentRoot /home/name/www

我的/home/name/www文件具有必要的權限。

drwxr-xr-x 3 www-data www-data www

但是,當我嘗試從瀏覽器訪問localhost ,我收到You don't have permission to access / on this server. 錯誤。 我錯過了什么?

為了將默認的apache根目錄從/var/www更改為/home/<username>/www以下更改對我有效。 我這樣編輯了etc / apache2 / apache2.conf文件的以下值。 在編輯文件之前,最好保留原始文件的備份。

<Directory />
        Options FollowSymLinks
        AllowOverride None
</Directory>

<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>

<Directory /home/<username>/www>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
</Directory>

然后,我更改了/etc/apache2/sites-available/000-default.conf文件的DocumentRoot

DocumentRoot /home/<username>/www

之后,重新啟動apache服務器,

sudo service apache2 restart

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM