先到/etc/httpd/conf.d目录下创建一个vhost.conf文件
复制以下内容
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| <VirtualHost *:80> ServerName 192.168.1.107 DocumentRoot /home/impress/common/www/ <Directory "/home/impress/common/www/"> DirectoryIndex index.html index.php Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> ErrorLog /var/log/httpd/${HOSTNAME}_error.log LogLevel warn CustomLog /var/log/httpd/${HOSTNAME}_access.log combined </VirtualHost>
<IfModule dir_module> Alias /sony "/home/impress/common/sony" <Directory /home/impress/common/sony> DirectoryIndex index.html index.php Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> </IfModule>
|
使用
重新启动apahce2服务器
为了不出现403错误,请事先之间将指定的目录创建好,并给与相应的权限包括它的上级目录。