要解决Apache web服务器无法从DocumentRoot中提供静态文件的问题,可以按照以下步骤操作:
DocumentRoot "/var/www/html"
sudo chown -R www-data:www-data /var/www/html
sudo chmod -R 755 /var/www/html
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
sudo a2enmod rewrite
sudo a2enmod alias
然后重启Apache服务器:
sudo service apache2 restart
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT
然后保存并重新加载防火墙规则:
sudo iptables-save > /etc/iptables/rules.v4
sudo iptables-restore < /etc/iptables/rules.v4
完成以上步骤后,重新启动Apache服务器:
sudo service apache2 restart
这样,Apache web服务器应该能够从DocumentRoot中提供静态文件了。