我使用cpanel创建了一个通配符子域,并尝试将所有子域指向特定的.wsgi文件。
<VirtualHost my.server_ip.address:9999>
ServerName _wildcard_.domain.tld
ServerAlias *.domain.tld
# DocumentRoot /home/my_acct/public_html
ServerAdmin webmaster@domain.tld
UseCanonicalName Off
CustomLog /usr/local/apache/domlogs/_wildcard_.domain.tld combined
CustomLog /usr/local/apache/domlogs/_wildcard_.domain.tld-bytes_log "%{%s}t %I .\n%{%s}t %O ."
## User my_acct # Needed for Cpanel::ApacheConf
UserDir enabled my_acct
<IfModule mod_suphp.c>
suPHP_UserGroup my_acct my_acct
</IfModule>
<IfModule !mod_disable_suexec.c>
<IfModule !mod_ruid2.c>
SuexecUserGroup my_acct my_acct
</IfModule>
</IfModule>
<IfModule mod_ruid2.c>
RMode config
RUidGid my_acct my_acct
</IfModule>
<IfModule itk.c>
# For more information on MPM ITK, please read:
# http://mpm-itk.sesse.net/
AssignUserID my_acct my_acct
</IfModule>
ScriptAlias /cgi-bin/ /home/my_acct/public_html/cgi-bin/
# To customize this VirtualHost use an include file at the following location
Include "/usr/local/apache/conf/userdata/std/2_2/my_acct/wildcard_safe.domain.tld/*.conf"
</VirtualHost>
以下代码是 wildcard_safe.domain.tld / * .conf 中的代码,只有1个.conf,我将其命名为subdomain.conf
SetEnvIf Host "^(\w+).domain.tld" subdomain=$1
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
WSGIDaemonProcess pyramid_subdomain user=my_acct group=my_acct threads=4 \
python-path=/home/my_acct/modwsgi/env/lib/python2.6/site-packages
WSGIScriptAlias / /home/my_acct/modwsgi/env/pyramidsub_%{ENV:subdomain}.wsgi
WSGIScriptAlias /admin /home/my_acct/modwsgi/env/pyramidsub_%{ENV:subdomain}.wsgi
<Directory /home/my_acct/modwsgi/env>
WSGIProcessGroup pyramid_subdomain
Order allow,deny
Allow from all
</Directory>
以下是 pyramidsub_test.wsgi 文件
from pyramid.paster import get_app, setup_logging
ini_path = '/home/my_acct/modwsgi/env/MyFirstApp/production_subtest.ini'
setup_logging(ini_path)
application = get_app(ini_path, 'main')
我还确保在/ home / my_acct / modwsgi / env /中有一个pyramidsub_test.wsgi。
设置完所有后,我重启了apache,然后转到test.mydomain.com。 然而,它显示一个未找到的网站,我已经检查了apache error_log,但我不能 找到记录的任何错误。但是,我查看主要没有问题 域名(www.domain.com)
这是我第一次来自php背景的服务器设置等。
非常感谢任何帮助。