Ubuntu

在 ubuntu 伺服器上使用 mod_wsgi 在 Apache 下執行 Pootle 伺服器

  • January 18, 2019

我已經按照此處的說明使用 django 預設伺服器在 localhost 環境中成功安裝了 pootle 伺服器:http: //docs.translatehouse.org/projects/pootle/en/stable-2.8.x/server/installation.html

然後我按照此處的說明成功地將 nginx 設置為反向代理伺服器:http: //docs.translatehouse.org/projects/pootle/en/stable-2.8.x/server/web.html#proxying-with-nginx

然後我按照此處的說明成功地將數據庫從 SQLite 遷移到 MySQL:http: //docs.translatehouse.org/projects/pootle/en/stable-2.8.x/server/mysql_installation.html#mysql-installation

現在我想採取下一步行動,在 apache 下使用 mod_wsgi 執行 pootle 伺服器,以免使用預設的 django 伺服器,因為我已經準備好使用成熟的生產伺服器。我按照這裡的說明操作:http: //docs.translatehouse.org/projects/pootle/en/stable-2.8.x/server/web.html#apache-with-mod-wsgi

我已成功載入起始頁,但嘗試登錄時遇到問題。我在 chrome 控制台中收到此錯誤: vendor.min.ce9c05c2.js:25 POST http://pootle.localhost/var/www/vhosts/pootle/env/lib/python2.7/site-packages/pootle/accounts/login/?next=%2F 402 (Payment Required)

起始頁在http://pootle.localhost上顯示得很好,所以我很確定資產是直接載入的,Apache 指令沒有任何問題:

Alias /assets /var/www/vhosts/pootle/env/lib/python2.7/site-packages/pootle/assets/

apache 和 wsgi 之間似乎有問題,因為我認為我不應該在 POST 的 URL 中看到**/var/www/vhosts/pootle/env/lib/python2.7/site-packages/pootle ?**

好吧,我發現了問題所在。我應該為此踢自己。我在 pootle.conf 的末尾有這個:

# - Include the following settings in your custom Pootle settings:
STATIC_URL = '/assets/'
FORCE_SCRIPT_NAME = '/var/www/vhosts/pootle/env/lib/python2.7/site-packages/pootle/'
POOTLE_ENABLE_API = True

FORCE_SCRIPT_NAME 顯然應該是:

FORCE_SCRIPT_NAME = '/'

問題解決了,我犯了愚蠢的錯誤。

引用自:https://serverfault.com/questions/949435