html - 如何在 apache 上部署静态页面
PHP中文网
PHP中文网 2017-04-17 13:24:46
[HTML讨论组]

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

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 目录下

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

PHP中文网
PHP中文网

认证高级PHP讲师

全部回复(2)
ringa_lee

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

再不行我就没辙了|_|

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号