我只能访问1个网站'/ resume /',子目录网站在外部不可见?网站'/ resume2 /'试图指向/ resume /。所有子站点都试图指向/ resume /
<VirtualHost *:80>
ServerName resume
ServerAlias resume
DocumentRoot "/var/www/html/resume/"
<Directory /var/www/html/resume/>
DirectoryIndex index.php phpinfo.php index.html index.htm
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName resume2
ServerAlias resume2
DocumentRoot "/var/www/html/resume2/"
<Directory /var/www/html/resume2/>
DirectoryIndex index.php phpinfo.php index.html index.htm
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
答案 0 :(得分:2)
我很确定你应该在VirtualHost标签后面定义不同的主机名/ IP或端口,例如:
<VirtualHost resume.mydomain.de:80>
ServerAlias resume
ServerName resume.mydomain.de
DocumentRoot "/var/www/html/resume/"
...
</VirtualHost>
<VirtualHost resume2.mydomain.de:80>
ServerAlias resume
ServerName resume.mydomain.de
DocumentRoot "/var/www/html/resume2/"
...
</VirtualHost>
...其中 resume.mydomain.de 和 resume2.mydomain.de 被解析为两个在主机上配置的不同IP。您也可以使用相同的IP和不同的端口。无论如何,请记住,您需要为每个VirtualHost添加一个listen标签。
希望有所帮助!干杯......