繁体   English   中英

在Ubuntu 12.04上的Apache 2.2上部署Django 2.0

[英]Deploy Django 2.0 on Apache 2.2 at ubuntu 12.04

我的环境:

ubuntu 12.04 / python3.6.4 / django 2.0 / Apache 2.2.22

我想在Apache上部署新站点

我跟随django官方

我想部署在

www.domainname.com/newsite/

我的httpd.conf

<Directory /home/usr/project_name/project_name>
    <Files wsgi.py>
      Order deny,allow
      Deny from all
    </Files>
</Directory>
WSGIDaemonProcess site python-path=/home/usr/site
WSGIProcessGroup site
WSGIScriptAlias /newsite/  /home/usr/project_mame/project_name/wsgi.py

如果我在python-home中添加虚拟环境,则无法通过configtest

我浏览127.0.0.1,它显示apache“有效”页面

但是127.0.0.1/newsite我刚被禁止403

日志:客户端被服务器配置拒绝:xxxxxx / xxxxxx / wsgi.py

尝试:

<VirtualHost *:9002>

        ServerName complete_hostname #result of hostname -f

        WSGIDaemonProcess Django_project_name python-path=/var/www/html/Django_project_name
        WSGIProcessGroup Django_project_name 
        WSGIScriptAlias / /var/www/html/Django_project_name/Django_project_name /wsgi.py

        <Directory /var/www/html/Django_project_name/Django_project_name >
        <Files wsgi.py>
                Require all granted               
        </Files>
        </Directory>    
</VirtualHost>

如果您使用的Apache版本早于2.4,则将“ Allow from all Require all granted替换为“ Require all granted Allow from all并在其上方添加“ Order deny,allow ”行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM