我昨天得到了一个Raspberry Pi,并在上面安装了一个额外的硬盘驱动器。我打算用它来做网络服务器。然而,我希望将我的文件存放在硬盘上,而不是操作系统所在的小SD卡上。
我安装了Apache并创建了一个虚拟主机配置文件,指定了DocumentRoot和网站所在的外部硬盘上的目录。然而,它给出了一个403错误。系统日志给出了以下信息。
Permission denied: [client 123.456.789.1250527] AH00035: access to / denied (filesystem path '/media/myusername/myHDD') because search permissions are missing on a component of the path
我尝试了许多不同的方法:将DocumentRoot设置为varwwwhtml,但在Directory标签中指定了HDD的路径,将默认站点中的DocumentRoot改为我想要服务的HDD目录的路径,在apache2.conf文件中添加DocumentRoot "mediamyusernamemyHDD "一行。我把myHDD文件夹的所有权改为www-data用户。最后我删除了varwwwhtml文件夹,并创建了一个指向HDD目录的符号链接,名称为 html
但这导致了这个错误。
AH00037: Symbolic link not allowed or link target not accessible: /var/www/html
我需要做什么才能让Apache服务于这些在HDD上的网站 而不是系统的SD(只有16GB)?这是我的VirtualHost配置。
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName myurl.com
ServerAlias www.myurl.com
DocumentRoot "/var/www/html"
Alias "/webals" "/media/userName/MyHardDrive/public_html/myurl.com/"
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/media/userName/MyHardDrive/public_html/myurl.com">
Require all granted
Order allow,deny
Allow from all
</Directory>
我不知道这是怎么回事。过去没有真正使用过Apache - 更喜欢使用nginx。
任何帮助将是很好的。