当文档根目录现在是几个文件夹时如何更改虚拟主机条目
Posted
技术标签:
【中文标题】当文档根目录现在是几个文件夹时如何更改虚拟主机条目【英文标题】:How to change vhosts entry when document root is now a few folders further down 【发布时间】:2014-12-15 06:56:56 【问题描述】:我在虚拟机中使用 Ubuntu。我有一个创建 Drupal 站点并设置适当的虚拟主机条目的脚本。下面是一个例子:
<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>
我已经检查了一个要处理的站点,但是 Web 根目录现在是几个文件夹。所以不要像这样:
/home/drupalpro/websites/d7.dev
现在
/home/drupalpro/websites/d7.dev/folder1/site-root
我需要对原始 vhosts 文件进行哪些更改?是 DocumentRoot 和 Directory,而不是 ServerName 和 ServerAlias?
【问题讨论】:
【参考方案1】:从实验来看,这似乎是正确的:
<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>
【讨论】:
以上是关于当文档根目录现在是几个文件夹时如何更改虚拟主机条目的主要内容,如果未能解决你的问题,请参考以下文章
MongoDB - 仅当嵌套数组中的所有条目存在时才更新它们
当条目在 Gtk Python 中获得焦点时如何更改输入语言