2013-01-06 22 views
4

我用我的個人服務器上的Apache,而我想上www.mydomain.com/運行與Silex做了「主」的網站,另一種使用作了關於Flaskwww.mydomain.com/something運行燒瓶網站的子目錄與Apache

要運行Flask網站,我正在使用mod_wsgi,正如其官方網站(http://flask.pocoo.org/docs/deploying/mod_wsgi/)所述。

它工作的很好,我可以到達我的網站www.mydomain.com/something,但是當我回到www.mydomain.com/我得到一個Flask 404錯誤消息。

我已經試過檢查apache文檔有關虛擬主機,但我無法理解它,這是我目前'sites-enabled/defaults'配置文件:

<VirtualHost *:80> 
     ServerAdmin [email protected] 

     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> 

     WSGIDaemonProcess bc user=bc group=bc threads=5 
     WSGIScriptAlias//var/www/bc/bc.wsgi 
     <Directory /var/www/bc> 
        WSGIProcessGroup bc 
        WSGIApplicationGroup %{GLOBAL} 
        Order deny,allow 
        Allow from all 
     </Directory> 

     ErrorLog ${APACHE_LOG_DIR}/error.log 

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

     CustomLog ${APACHE_LOG_DIR}/access.log combined 
</VirtualHost> 

/var/www目錄如下:

./index.php 

./bc/ 

./bc/index.py 

如何讓python網站只能在www.mydomain.com/something中工作,並讓PHP運行在www.mydomain.com/上?

+0

你見過http://stackoverflow.com/questions/7558249/nginx-configuration-for-static-sites-in-root-directory-flask-apps-in-subdirecto? –

+0

剛剛看到有關於apache的評論...我會盡力做它說的,謝謝。 –

回答

4

WSGIScriptAlias的第一個參數是url path,通過指定WSGIScriptAlias/<foo>告訴apache發送所有請求到WSGI應用程序。嘗試WSGIScriptAlias /something <foo>