我正在使用 apache 網路服務器在我的 VPS 上部署我的 django 應用程式。它完全可以正常作業,http://192.46.209.82:8000/但是當我嘗試使用我的 IP 地址訪問它時,192.46.209.82. 我得到
Forbidden
You don't have permission to access this resource.
Apache/2.4.41 (Ubuntu) Server at 192.46.209.82 Port 80
這是我的 conf 檔案
nano /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /root/django/myproject
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /static /root/django/myproject/static
<Directory /root/django/myproject/static>
Require all granted
</Directory>
<Directory /root/django/myproject/myproject>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess myproject python-path=/root/django/myproject python-home=/root/django/myprojectenv
WSGIProcessGroup myproject
WSGIScriptAlias / /root/django/myproject/myproject/wsgi.py
</VirtualHost>
我正在使用 python 的虛擬環境,其中 myprojectenv 是我的虛擬環境路徑,而 pwd 是 /root/django

注意:我嘗試了我作為對這個問題的建議而得到的問題的答案,但這對我不起作用。
編輯:更新權限

uj5u.com熱心網友回復:
在我的情況下,即使我正確設定了所有權限,我仍然遇到錯誤,所以我將整個專案和虛擬環境移到了/opt,它現在對我有用。但是我想知道為什么/home即使我授予了所有權限它也無法正常作業
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/334787.html
標籤:Python 姜戈 阿帕奇 mod-wsgi wsgi
上一篇:APACHE權限都設定好了但是還沒有權限(*已解決*)
下一篇:如何使用混合分隔符(即方括號、空格和雙引號)來決議日志(nginx/apacheaccess.log)?并可選擇轉換為json
