前言
基本的apache配置可参考文章http://www.cnblogs.com/2dogslife/p/8437170.html
项目
有两个项目reimbursement和sinotran,目录分别为C:/tmp/reimbursement/和C:/virtualenv/sinotrans/
在该项目文件下分别建立文件夹apache用来存放apache相关的配置文件
配置二级域名
需求:reimbursement.yunyoutec.com访问reimbursement项目,yunyoutec.com访问sinotrans项目
在httpd.conf文件里添加以下代码
NameVirtualHost *:80
<VirtualHost *:80>
ServerName reimbursement.yunyoutec.com
ServerAdmin navicester@163.com
DocumentRoot "C:/tmp/reimbursement/"
WSGIScriptAlias / "C:/tmp/reimbursement/apache/django.wsgi"
<Directory "C:/tmp/reimbursement/">
Options FollowSymLinks Includes ExecCGI
AllowOverride None
Order deny,allow
Allow from all
</Directory>
ErrorLog "logs/reimbursement-error.log"
CustomLog "logs/reimbursement-access.log" common
Alias /static "C:/tmp/reimbursement/static_in_env/static_root"
<Directory "C:/tmp/reimbursement/static_in_env">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
NameVirtualHost *:80
<VirtualHost *:80>
ServerName yunyoutec.com
ServerAlias www.yunyoutec.com
DocumentRoot "C:/virtualenv/sinotrans/"
<Directory "C:/virtualenv/sinotrans/">
Options FollowSymLinks Includes ExecCGI
AllowOverride None
Order deny,allow
Allow from all
</Directory>
<Directory "C:/virtualenv/sinotrans/static_in_env">
Order allow,deny
Allow from all
</Directory>
Alias /static "C:/virtualenv/sinotrans/static_in_env/static_root"
WSGIScriptAlias / "C:/virtualenv/sinotrans/apache/django.wsgi"
</VirtualHost>
关注下方公众号获取更多文章