当文档根目录进一步向下时,如何更改vhosts条目

时间:2014-10-20 10:12:00

标签: vhosts

我在VM中使用Ubuntu。我有一个脚本,可以创建Drupal站点并设置相应的vhosts条目。以下是一个例子:

<VirtualHost *:80>
  ServerName d7.dev
  ServerAlias *.d7.dev
  DocumentRoot /home/drupalpro/websites/d7.dev
  <Directory /home/drupalpro/websites/d7.dev>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>
</VirtualHost>
<IfModule mod_ssl.c>
  <VirtualHost *:443>
    ServerName d7.dev
    ServerAlias *.d7.dev
    DocumentRoot /home/drupalpro/websites/d7.dev
    <Directory /home/drupalpro/websites/d7.dev>
      Options Indexes FollowSymLinks MultiViews
      AllowOverride All
      Order allow,deny
      allow from all
    </Directory>
    SSLEngine on
    SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
    SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
  </VirtualHost>
</IfModule>

我已经检查了一个网站,但是网络根现在是几个文件夹。所以不要这样:

/home/drupalpro/websites/d7.dev

现在

/home/drupalpro/websites/d7.dev/folder1/site-root

我需要从原始vhosts文件更改哪些内容?它是DocumentRoot和Directory而不是ServerName和ServerAlias吗?

1 个答案:

答案 0 :(得分:0)

从实验来看,这似乎是正确的:

<VirtualHost *:80>
  ServerName d7.dev
  ServerAlias *.d7.dev
  DocumentRoot /home/drupalpro/websites/d7.dev/folder1/site-root
  <Directory /home/drupalpro/websites/d7.dev/folder1/site-root>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>
</VirtualHost>
<IfModule mod_ssl.c>
  <VirtualHost *:443>
    ServerName d7.dev
    ServerAlias *.d7.dev
    DocumentRoot /home/drupalpro/websites/d7.dev/folder1/site-root
    <Directory /home/drupalpro/websites/d7.dev/folder1/site-root>
      Options Indexes FollowSymLinks MultiViews
      AllowOverride All
      Order allow,deny
      allow from all
    </Directory>
    SSLEngine on
    SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
    SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
  </VirtualHost>
</IfModule>