[英]Error 403: Forbidden You don't have permission to access / on this server with apache, mod-wsgi and django
[英]Django Deployment: Error 403 Forbidden You don't have permission to access / on this server
I'm currently deploying my Django app into a CentOS 7 Server (CentOS Linux release 7.8.2003) based on Django documentation here . 但是我遇到了下面錯誤日志中所述的這個問題(錯誤 403)。
注意事項:
是的,我能夠通過虛擬環境端口 8000 運行服務器。
我使用的數據庫是 mysql( 指南)。
這和apache設置的訪問權限有關系嗎? 目前,我已將 apache 的權限設置如下:
sudo chown:apache colus_cafe/ sudo chown -R:apache colus_cafe/colus_cafe/media
/etc/httpd/conf.d/django.conf:
Alias /static /home/colus/colus_cafe/colus_cafe/static
<Directory /home/colus/colus_cafe/colus_cafe/static>
Require all granted
</Directory>
Alias /media /home/colus/colus_cafe/colus_cafe/media
<Directory /home/colus/colus_cafe/colus_cafe/media>
Require all granted
</Directory>
<Directory /home/colus/colus_cafe/colus_cafe>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIScriptAlias / /home/colus/colus_cafe/colus_cafe/wsgi.py
WSGIDaemonProcess colus_cafe_app python-home=/home/colus/colus_cafe/env python-path=/home/colus/colus_cafe
WSGIProcessGroup colus_cafe_app
/etc/httpd/logs/error_log
Current thread 0x00007fee066d6880 (most recent call first):
[Wed Jul 08 07:11:09.691137 2020] [mpm_prefork:notice] [pid 10044] AH00170: caught SIGWINCH, shutting down gracefully
[Wed Jul 08 07:11:10.768060 2020] [core:notice] [pid 10231] SELinux policy enabled; httpd running as context system_$
[Wed Jul 08 07:11:10.769024 2020] [suexec:notice] [pid 10231] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/$[Wed Jul 08 07:11:10.789925 2020] [so:warn] [pid 10231] AH01574: module wsgi_module is already loaded, skipping
[Wed Jul 08 07:11:10.793580 2020] [lbmethod_heartbeat:notice] [pid 10231] AH02282: No slotmem from mod_heartmonitor
[Wed Jul 08 07:11:10.796988 2020] [mpm_prefork:notice] [pid 10231] AH00163: Apache/2.4.6 (CentOS) mod_wsgi/4.6.2 Pyt$[Wed Jul 08 07:11:10.797021 2020] [core:notice] [pid 10231] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Wed Jul 08 07:11:10.798024 2020] [wsgi:warn] [pid 10232] (13)Permission denied: mod_wsgi (pid=10232):
Unable to stat Python home /home/colus/colus_cafe/env.
Python interpreter may not be able to be initialized correctly.
Verify the supplied path and access permissions for whole of the path.
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'
根據 Maarten 的評論,我找到了這個問題的答案。
/etc/httpd/logs/error_log
failed to map segment from shared object permission denied mysql.
我希望這可以幫助任何遇到這個問題的人。 如果我犯了任何不良做法或錯誤,請發表評論。
謝謝你,祝你有美好的一天。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.