我目前在 Windows 上的 Apache 服务器设置遇到问题。我已经能够使用 httpd.exe 成功运行 Apache,但是当我尝试使用
net start apache2.4
启动它时,该服务无法启动,并且我在事件查看器中收到错误(尽管没有相应的 Apache 错误日志)
1。直接运行httpd.exe:
**2。跑步
httpd -t
**
Syntax OK
。3. Windows 事件查看器错误:
The Apache service named reported the following error:
>>> httpd.exe: Syntax error on line 194 of C:/Apache24/conf/httpd.conf:
Cannot load C:/Users/{me}/AppData/Local/Programs/Python/Python313/Lib/site-packages/mod_wsgi/server/mod_wsgi.cp313-win_amd64.pyd
into server: The specified module could not be found. .
4。已验证的文件路径:
c:\Apache24\bin>dir "C:\Users\{me}\AppData\Local\Programs\Python\Python313\Lib\site-packages\mod_wsgi\server"
Volume in drive C is Windows
Volume Serial Number is 8205-BA06
Directory of C:\Users\{me}\AppData\Local\Programs\Python\Python313\Lib\site-packages\mod_wsgi\server
10/23/2024 02:49 PM <DIR> .
10/23/2024 02:49 PM <DIR> ..
10/23/2024 02:49 PM 1,097 apxs_config.py
10/23/2024 02:49 PM 3,563 environ.py
10/23/2024 02:49 PM <DIR> management
10/23/2024 02:49 PM 134,656 mod_wsgi.cp313-win_amd64.pyd
10/23/2024 02:49 PM 138,014 __init__.py
10/23/2024 02:49 PM <DIR> __pycache__
4 File(s) 277,330 bytes
4 Dir(s) 56,747,614,208 bytes free
httpd.exe
运行良好,但使用 net start apache2.4
时失败。LoadModule wsgi_module "C:/Users/{me}/AppData/Local/Programs/Python/Python313/Lib/site-packages/mod_wsgi/server/mod_wsgi.cp313-win_amd64.pyd"
WSGIPythonHome "C:/Users/{me}/AppData/Local/Programs/Python/Python313"
WSGIPythonPath "C:/{my_webapp}"
<VirtualHost *:80>
ServerName .com
ServerAlias www.{my_webapp}.com
DocumentRoot "C:/{my_webapp}"
WSGIScriptAlias / C:/{my_webapp}/{my_webapp}/wsgi.py
WSGIApplicationGroup %{GLOBAL}
LogLevel info wsgi:debug
<Directory C:/{my_webapp}/{my_webapp}>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
Alias /static/ C:/{my_webapp}/static/
<Directory C:/{my_webapp}/static>
Require all granted
</Directory>
ErrorLog "C:/Apache24/logs/{my_webapp}_error.log"
CustomLog "C:/Apache24/logs/{my_webapp}_access.log" common
</VirtualHost>
为什么Apache可以通过httpd.exe运行,但使用net start apache2.4时却失败?我该如何进一步解决这个问题,特别是考虑到 Apache 中缺少日志?
任何帮助或建议将不胜感激!预先感谢。
根据相关帖子中的最后一个链接。
奔跑
mod_wsgi-express module-config
替换我在 httpd.conf 中加载的内容以加载输出:
LoadFile "C:/Users/{me}/AppData/Local/Programs/Python/Python313/python313.dll"
LoadModule wsgi_module "C:/Users/{me}/AppData/Local/Programs/Python/Python313/Lib/site-packages/mod_wsgi/server/mod_wsgi.cp313-win_amd64.pyd"
WSGIPythonHome "C:/Users/{me}/AppData/Local/Programs/Python/Python313"