Apache新版配置虚拟主机的注意事项

1.关于没有默认索引文件(index.php或者index.html)时,列出目录:需要开启模块

LoadModule autoindex_module modules/mod_autoindex.so

且配合httpd-vhosts.conf的设置:

<Directory "E:/www/demo">
    Options Indexes FollowSymLinks
    # for rewrite
    AllowOverride Indexes FileInfo
</Directory>

Indexes 即: 如果输入的网址对应服务器上的一个文件目录,而此目录中又没有DirectoryIndex指令(例如:DirectoryIndex index.html index.php),那么服务器会返回由mod_autoindex模块生成的一个格式化后的目录列表

2.关于权限变为:Require all granted

<VirtualHost *:8081>
    ServerName www.smartmall.com
    DocumentRoot "D:/website/www.smartmall.com/frontend/web"
    <Directory "D:/website/www.smartmall.com/frontend/web">
	    Options Indexes FollowSymLinks
	    Require all granted
	    AllowOverride All
    </Directory>
</VirtualHost>

其中:AllowOverride All 是支持rewrite重写,需要开启httpd.conf中的 LoadModule rewrite_module modules/mod_rewrite.so

原文地址:https://www.cnblogs.com/intval/p/5403888.html