【问题标题】:How to configure mod_wsgi so that RockMongo is accessible in a subdirectory (404 error)?如何配置 mod_wsgi 以便可以在子目录中访问 RockMongo(404 错误)?
【发布时间】:2015-01-24 21:52:24
【问题描述】:

期望的行为

我希望能够通过localhost/rockmongo 访问 RockMongo。

当前行为

我得到:

Error: 404 Not Found
Sorry, the requested URL 'http://localhost/rockmongo' caused an error:
Not found: '/rockmongo'

环境

  • Linux Mint 17 肉桂
  • 阿帕奇
    • 服务器版本:Apache/2.4.7 (Ubuntu)
    • 服务器搭建时间:2014 年 7 月 22 日 14:36:38
  • mod_wsgi
  • virtualenv

/etc/apache2/sites-available/000-default.conf

WSGIPythonHome /var/www/html/ENV
WSGIPythonPath /var/www/html:/var/www/html/ENV/lib/python2.7/site-packages:/var/www/html/wsgi
<VirtualHost *:80>

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html
    WSGIScriptAlias / /var/www/html/wsgi/application

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

</VirtualHost>

目录权限

/var/www

drwxr-xr-x  3 root root   4096 Nov 23 08:58 www

/var/www/html

drwxr-xr-x 10 me me 4096 Nov 26 23:46 html

/var/www/html/rockmongo

drwxr-xr-x  5 me me 4096 Jun  6 23:04 rockmongo

Apache 错误日志

没有与此相关的错误。

【问题讨论】:

    标签: apache python-2.7 mod-wsgi


    【解决方案1】:

    我得到了它的工作,但我很想确认这是正确的方法,并且不会给 RockMongo 带来任何安全问题或干扰mod_wsgi 功能的其他方面。

    我在下面添加了Alias 行和Directory 块。

    /etc/apache2/sites-available/000-default.conf

    WSGIPythonHome /var/www/html/ENV
    WSGIPythonPath /var/www/html:/var/www/html/ENV/lib/python2.7/site-packages:/var/www/html/wsgi
    <VirtualHost *:80>
    
    # for all content in static folder - css, js, img, fonts
    Alias /static/ /var/www/html/wsgi/static/
    
    # for rockmongo
    Alias /rockmongo /var/www/html/rockmongo
    
    <Directory /var/www/html/rockmongo>
    Order deny,allow
    Allow from all
    </Directory>
    
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html
        WSGIScriptAlias / /var/www/html/wsgi/application
    
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    
    </VirtualHost>
    

    【讨论】:

      猜你喜欢
      • 2014-05-01
      • 2021-01-08
      • 2014-11-10
      • 1970-01-01
      • 2012-08-02
      • 1970-01-01
      • 1970-01-01
      • 2011-07-30
      相关资源
      最近更新 更多