首页 > 解决方案 > 部署 Django 网站时卡在 apache2 默认页面上

问题描述

我已经在网上浏览了一些答案,但我仍在努力通过 apache2 默认页面。webapp 在本地运行良好,无需 apache。我在 ubuntu 机器上为此使用 AWS EC2 实例。

整个代码托管在 /home/ubuntu/sm 机器上,venv/home/ubuntu/sm/venvip addr 3.XX212 上运行

我尝试添加、编辑、删除一些变量,但无济于事。我在错误日志中也一无所获。考虑到我已经坚持了多久,“优雅地重新开始”条目开始看起来很自恋。

apachectl -S产生以下响应:

[Tue Nov 05 05:16:52.198045 2019] [alias:warn] [pid 13664:tid 139764718218176] AH00671: The Alias directive in /etc/apache2/sites-enabled/sm.conf at line 33 will probably never match because it overlaps an earlier Alias.
VirtualHost configuration:
*:80                   ip-172-*-*-29.ap-southeast-2.compute.internal (/etc/apache2/sites-enabled/sm.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex default: dir="/var/run/apache2/" mechanism=default 
Mutex watchdog-callback: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33 not_used
Group: name="www-data" id=33 not_used

"sm.conf"是用于此的配置文件,如下所示:

    ServerAdmin webmaster@localhost

    LogLevel info
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /robots.txt /home/ubuntu/sm/website/static/robots.txt
    Alias /favicon.ico /home/ubuntu/sm/website/static/favicon.ico
    Alias /static/ /home/ubuntu/sm/website/static
    Alias /static/ /home/ubuntu/sm/media

    WSGIDaemonProcess website.net processes=2 threads=15 python-home=/home/ubuntu/sm/venv/lib/python3.6 python-path=/home/ubuntu/sm/
    WSGIProcessGroup website.net
    WSGIScriptAlias /sm /home/ubuntu/sm/sm/wsgi.py process-group=website.net

    <Directory /home/ubuntu/sm/>
            AllowOverride all 
            Require all granted 
            Options FollowSymlinks 
    </Directory> 

    <Directory /home/ubuntu/sm/sm>
            <Files wsgi.py>
            Require all granted
            </Files>
    </Directory>

    <Directory /home/ubuntu/sm/website/static/>
            Require all granted
    </Directory>

    <Directory /home/ubuntu/sm/media>
            Require all granted
    </Directory>

对劣质代码的评论、关注、建议、批评,都值得赞赏。

标签: djangoapache2mod-wsgi

解决方案


推荐阅读