2012-02-24 4 views
0

Я хочу протестировать mod_wsgi на моем сервере - Ubuntu Server.
Мой .htaccess:Ошибка Mod_wsgi - LoadModule не разрешен здесь

LoadModule wsgi_module modules/mod_wsgi.so 
WSGIScriptAlias//home/apps/hello.py 

Мой hello.py:

def application(environ, start_response): 
    status = '200 OK' 
    output = 'Hello World!' 

    response_headers = [('Content-type', 'text/plain'), 
         ('Content-Length', str(len(output)))] 
    start_response(status, response_headers) 

    return [output] 

Apache возвращает:

.htaccess: LoadModule здесь не допускается

Мой апач конф (/ etc/apache2/sites-enabled/000-default):

<VirtualHost *:80> 
     ServerAdmin [email protected] 

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

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

     ErrorLog /var/log/apache2/error.log 

     # Possible values include: debug, info, notice, warn, error, crit, 
     # alert, emerg. 
     LogLevel warn 

     CustomLog /var/log/apache2/access.log combined 

    Alias /doc/ "/usr/share/doc/" 
    <Directory "/usr/share/doc/"> 
     Options Indexes MultiViews FollowSymLinks 
     AllowOverride All 
     Order deny,allow 
     Deny from all 
     Allow from 127.0.0.0/255.0.0.0 ::1/128 
    </Directory> 

</VirtualHost> 

.htaccess в/вар/WWW/суб/
Что случилось с этим?

+0

Можете ли вы сделать это из '.htaccess'? – Blender

+0

находится внутри .htaccess – user1227535

ответ

1

от Apache документ:

Description: Links in the object file or library, and adds to the list of active modules 
Syntax: LoadModule module filename 
Context: server config 
Status: Extension 
Module: mod_so 

, потому что его контекст Server config, поэтому вы не можете использовать его в .htaccess.

+0

, так что мне нужно сделать все это в/etc/apache2/sites-enabled/000-default? – user1227535

+0

поместите это в 'etc/apache2/apache2.conf' (главный файл конфигурации Apache) – undone

+1

IOW, также должен быть вне любого VirtualHost. В дистрибутивах Linux Apache обычно есть каталог под названием mods-available, который содержит файл для каждого типа модуля и LoadModule. Посмотрите документацию для своего дистрибутива. –

Смежные вопросы