Apache,Web.py和Mod_WSGI问题 - 未找到页面

时间:2014-03-30 21:06:18

标签: python apache2 mod-wsgi

请帮助我知道我的配置Apache + Web.py + Mod_WSGI有什么问题,我的网站无法加载,这是我的配置:

Apache版本:2.7.4

Web.py版本 - > https://github.com/webpy/webpy

mod_wsgi - >不确定3.3还是3.4

目录 的/ var / WWW / pyapps / BOT

  

网络 - >链接webpy   webpy   code.py   静态的   模板

的Apache         ServerAdmin webmaster @ localhost

    DocumentRoot /var/www
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>

    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>


    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    CustomLog ${APACHE_LOG_DIR}/access.log combine

    WSGIScriptAlias /sitea /var/www/pyapps/bot/code.py/

    Alias /sitea/static /var/www/pyapps/bot/static

    Alias /sitea/templates /var/www/pyapps/bot/templates

    AddType text/html .py

    <Directory /var/www/pyapps/bot>

           Order deny,allow

           Allow from All
    </Directory>
    <Directory /sitea/static>
            Options +Indexes
     </Directory>

Code.py

导入网站

urls =(      &#39; /.*',&#39;你好&#39;,      )

班你好:      def GET(个体经营):          返回&#34;你好,世界。&#34;

application = web.application(urls,globals())。wsgifunc()

结果

未找到

在此服务器上找不到请求的URL / sitea。

Apache / 2.2.22(Ubuntu)服务器位于xxx.xxx.xxx.xxx端口80

1 个答案:

答案 0 :(得分:1)

您不应该在WSGIScriptAlias路径的末尾有一个尾部斜杠:

WSGIScriptAlias /sitea /var/www/pyapps/bot/code.py

另请注意,您不应该在文档根目录(/ var / www)中包含WSGI应用程序文件。将它们放在其他位置(并相应地更改WSGIScriptAlias路径)。