Centos
Apache/httpd 錯誤:無效命令 ‘WSGIPythonHome’
問題:
我的 Apache/httpd 伺服器不會啟動。
journalctl -xe
揭示:Feb 27 01:50:12 localhost.localdomain httpd[4398]: AH00526: Syntax error on line 355 of /etc/httpd/conf/httpd.conf: Feb 27 01:50:12 localhost.localdomain httpd[4398]: Invalid command 'WSGIPythonHome', perhaps misspelled or defined by a module not included in the server configuration Feb 27 01:50:12 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE Feb 27 01:50:13 localhost.localdomain kill[4399]: kill: cannot find process "" Feb 27 01:50:13 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1 Feb 27 01:50:13 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
httpd -S
揭示:AH00526: Syntax error on line 355 of /etc/httpd/conf/httpd.conf: Invalid command 'WSGIPythonHome', perhaps misspelled or defined by a module not included in the server configuration
眼鏡
- CentOS 7(這是在 Ubuntu 18.10 主機上執行的虛擬機)
rh-python36
已安裝rh-python36-mod_wsgi-4.5.18-1.el7.x86_64
已安裝- python 虛擬環境創建於
/var/www/web-virt-env
httpd.conf:
WSGIPythonHome /var/www/web-virt-env WSGIPythonPath /var/www/html/somewebsite <VirtualHost *:80> ServerName awebsite.com DocumentRoot /var/www/html/somewebsite WSGIDaemonProcess somewebsite1 python-home=/var/www/web-virt-env WSGIProcessGroup somewebsite1 WSGIScriptAlias / /var/www/html/somewebsite/somewebsite/wsgi.py <Directory /var/www/html/somewebsite/somewebsite> Require all granted </Directory> Alias /static /var/www/html/somewebsite/static <Directory /var/www/html/somewebsite/static> Require all granted </Directory> </VirtualHost>
預期輸出:
我預計該網站會在我執行時啟動
systemctl start httpd
我懷疑它
rh-python36-mod_wsgi-4.5.18-1.el7.x86_64
沒有被“找到”,但我不確定這在幕後是如何運作的。我能做些什麼來解決這個問題?或者至少,我應該採取哪些步驟來解決這個問題?
尤里卡!
我能夠通過在問題中顯示的添加之前添加以下內容來解決問題*(*
httpd.conf
所以,就在之前WSGIPythonHome /var/www/web-virt-env
):
LoadModule wsgi_module /opt/rh/httpd24/root/usr/lib64/httpd/modules/mod_rh-python36-wsgi.so
我把它放在虛擬主機之前
LoadModule wsgi_module /usr/lib64/apache2/modules/mod_wsgi.so <VirtualHost 69.16.201.27:443> ServerName blue.domain.com ....