我apache2
在我的系统上运行两个不同的实例,它们(显然)在不同的端口 - 12345 和 12346 上运行。
我想配置localhost
为在这两种情况下访问不同的位置。
这是我启用的网站:( try.conf
)
# Virtual Host Entries
<VirtualHost *:12346>
DocumentRoot "/var/www/server2"
ServerName localhost
DirectoryIndex index.html
<Directory "/var/www/server2">
Options +Indexes +FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
# Virtual Host Entries
<VirtualHost *:12345>
DocumentRoot "/var/www/server1"
ServerName localhost
DirectoryIndex index.html
<Directory "/var/www/server1">
Options +Indexes +FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
当我打开localhost:12345
时,我得到了所需的网页localhost:12346
,而在这种情况下,不是server2
目录中的索引,而是显示我的www
-directory。
这个网站,try.conf
在/etc/apache2/sites-available
。
我是否将其放入/etc/apache2-server1/sites-available
(apache 的第二个实例)或不作为a2ensite
命令启用任何配置都没有关系,因为默认情况下采用以前的路径。
那么,有什么方法可以分别.conf
为两个实例定义我的文件。如果没有,我的问题是什么try.conf