Ubuntu系统使用apache部署多个django项目(python4.3)

/etc/apache2/sites-available/pyweb.conf

<VirtualHost *:81>
    ServerName 192.168.1.46   
    DocumentRoot /var/www/pyweb/pyweb      
    <Directory /var/www/pyweb/pyweb>          
        Order allow,deny          
        Allow from all      
    </Directory>      
    WSGIScriptAlias / /var/www/pyweb/pyweb/wsgi.py

    ErrorLog ${APACHE_LOG_DIR}/error_81.log
    CustomLog ${APACHE_LOG_DIR}/access_81.log combined
</VirtualHost>

/etc/apache2/ports.conf

NameVirtualHost *:80
Listen 80

NameVirtualHost *:81
Listen 81

<IfModule ssl_module>
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>

 

参考:

http://www.cnblogs.com/helloworldtoyou/p/5978977.html

http://www.cnblogs.com/codemyzen/p/3690042.html

http://blog.csdn.net/o_surface_o/article/details/23278837

http://www.jianshu.com/p/b40a4a12fff1

http://blog.csdn.net/gamer_gyt/article/details/52135349

防火墙问题请参考:

http://www.cnblogs.com/jiangyao/archive/2010/05/19/1738909.html

Django静态文件配置

 

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
# 当运行 python manage.py collectstatic 的时候
# STATIC_ROOT 文件夹 是用来将所有STATICFILES_DIRS中所有文件夹中的文件,以及各app中static中的文件都复制过来
# 把这些文件放到一起是为了用apache等部署的时候更方便
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
<VirtualHost *:81>
    ServerName 192.168.1.105   
    DocumentRoot /var/www/cn/acn      
    <Directory /var/www/cn/acn>          
        Order allow,deny          
        Allow from all      
    </Directory>
    <Directory /var/www/cn/static> 
       Require all granted 
    </Directory>
    Alias /static /var/www/cn/static
    WSGIScriptAlias / /var/www/cn/acn/wsgi.py
    
    ErrorLog ${APACHE_LOG_DIR}/error_81.log
    CustomLog ${APACHE_LOG_DIR}/access_81.log combined
</VirtualHost>

 

posted on 2017-05-12 16:32  VincentZhu  阅读(228)  评论(0编辑  收藏  举报