如何在 apache 上部署静态页面

自己尝试了一下,一直是:

You don't have permission to access / on this server.

各位给个靠谱的教程可好?如果是中文就更好了。

附 /etc/apache2/conf-available 文件

<Directory /home/aias/testWEB>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

<IfModule dir_module>
DirectoryIndex index.html
</IfModule>

已做链接至 conf-enabled 目录下

各位可以帮我看看有什么问题吗?

阅读 9.1k
2 个回答

sites-enabled 和sites-available文件夹是不是也需要相应的配置?
是的。在之前配置的基础上,配置sites-enabled和sites-available就行了。写好配置文件做个连接

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /home/aias/testWEB
</VirtualHost>

记得reload一下,就可以了。

补充:

我在想是不是我的options缺点东西,那我改改再试试

DocumentRoot "/home/aias/testWEB"
<Directory "/home/aias/testWEB">
    Options -Indexes +FollowSymLinks +MultiViews
    AllowOverride All
    Require all granted
</Directory>

<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

我用这个是ok的,你要不试试?记得重启服务sudo apachectl restart

再不行我就没辙了|_|

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题