我跟踪了法尔科教程,现在一切都按照预期对两个用户(例如john和alice)和他们的相关目录(/var/www/john和/var/ww/alice)正常工作。
现在,我想进入下一个级别:而不是在/etc/apache2/sites-available/<username>上定义不同的vhost并重新启动Apache,我需要动态配置的大规模虚拟主机(http://httpd.apache.org/docs/2.2/vhosts/mass.html)。比如说,我的DNS服务器有用于:another.site.example.com的记录,我希望它的主目录位于/var/www/another.site/web。
问题是suexec和mod_fcgid的所有这些配置设置。我结束了我的httpd.conf草案(或者我应该创建一个类似于/etc/apache2/sites-available/mass_virtual的文件):
NameVirtualHost *:80
#default virtual host
<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com
ServerAdmin webmaster@example.com
DocumentRoot /var/www/root/web/
<IfModule mod_fcgid.c>
SuexecUserGroup web-admin web-admin
<Directory /var/www/root/web/>
Options +ExecCGI
Options -Indexes
AllowOverride All
AddHandler fcgid-script .php
FCGIWrapper /var/www/php-fcgi-scripts/root/php-fcgi-starter .php
Order allow,deny
Allow from all
</Directory>
</IfModule>
# ErrorLog /var/log/apache2/error.log
# CustomLog /var/log/apache2/access.log combined
ServerSignature Off
</VirtualHost>
#3rd-level subdomain virtual hosts
<VirtualHost *:80>
UseCanonicalName Off
ServerAlias *.example.com
#problematic email!
ServerAdmin webmaster@example.com
#is this /var/www/another.site/web or /var/www/www.another.site/web for
#a request for www.another.site.example.com ?
VirtualDocumentRoot /var/www/%-3+/web
<IfModule mod_fcgid.c>
#problematic group and user!
SuexecUserGroup web1 web1
<Directory /var/www/*/web/>
Options +ExecCGI
Options -Indexes
AllowOverride All
AddHandler fcgid-script .php
FCGIWrapper /var/www/php-fcgi-scripts/*/php-fcgi-starter .php
Order allow,deny
Allow from all
</Directory>
</IfModule>
# ErrorLog /var/log/apache2/error.log
# CustomLog /var/log/apache2/access.log combined
ServerSignature Off
</VirtualHost>ServerAdmin webmaster@example.com、一个SuexecUserGroup web1 web1和一个VirtualDocumentRoot /var/www/%-3+/web配置!IfModule不应该存在--如果mod_fcgid不能加载,那么服务器和Alow from all不同,我认为我应该使用Deny from all并打开一个php库目录!www.another.site.example.com的请求在mod_rewrite的帮助下透明地转换为www.example.com/~another.site,然后使用mod_userdir启用suexec怎么办?有什么想法或指令可以实现所有这些?
谢谢。
发布于 2013-11-22 15:11:18
在实践中,动态vhost特性不是最优的,因为您不够灵活(在某些情况下,.htaccess不够)。使用脚本来生成vhost,或者使用一些类似于木偶的东西来定义vhost (https://github.com/puppetlabs/puppetlabs-apache)。
btw:对于您的php设置,我将使用php (ondemand)和(mod_proxy_fcgi或mod_fastcgi)。使用php,您不需要suexec -每个用户都有自己的端口或套接字。
https://serverfault.com/questions/420530
复制相似问题