gpt4 book ai didi

apache - 403 禁止 : You don't have permission to access this resource. Apache/2.4.29 (Ubuntu) 服务器端口 443

转载 作者:行者123 更新时间:2023-12-04 18:59:13 25 4
gpt4 key购买 nike

我正在尝试在 https 上运行我的实例,它抛出了这个错误。
如果我删除 SSL,它在 http 上工作正常。
这是我在 error.log 上收到的消息:

AH01630: client denied by server configuration: /home/ubuntu/readingroots/
AH01630: client denied by server configuration: /home/ubuntu/readingroots/favicon.ico, referer: https://readingroots.in/
这是我的 000-default.conf文件配置:
<VirtualHost *:80>
ServerAdmin admin@djangoproject.localhost
ServerName readingroots.in
ServerAlias www.readingroots.in
DocumentRoot /home/ubuntu/readingroots
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /static /home/ubuntu/readingroots/static
<Directory /home/ubuntu/readingroots/static>
Require all granted
</Directory>
<Directory /home/ubuntu/readingroots/readbus_project>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess readingroots python-path=/home/ubuntu/readingroots python-home=/home/ubuntu/readingroots/myprojectenv
WSGIProcessGroup readingroots
WSGIScriptAlias / /home/ubuntu/readingroots/readbus_project/wsgi.py

RewriteEngine on
RewriteCond %{SERVER_NAME} =www.readingroots.in [OR]
RewriteCond %{SERVER_NAME} =readingroots.in
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
这是我的 000-default-le-ssl.conf配置文件:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin admin@djangoproject.localhost
ServerName readingroots.in
ServerAlias www.readingroots.in
DocumentRoot /home/ubuntu/readingroots
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /static /home/ubuntu/readingroots/static
<Directory /home/ubuntu/readingroots/static>
Require all granted
</Directory>
<Directory /home/ubuntu/readingroots/readbus_project>
<Files wsgi.py>
Require all granted
</Files>
</Directory>


Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/readingroots.in/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/readingroots.in/privkey.pem
</VirtualHost>
</IfModule>
我尝试了各种方法,但似乎没有任何效果。
请帮助并让我知道我是否可以尝试任何事情。
编辑:
这是运行 ls -l /home/ubuntu/readingroots 后的输出命令:
total 2164
drwxrwxr-x 5 ubuntu ubuntu 4096 Jul 26 18:23 actions
drwxrwxr-x 5 ubuntu ubuntu 4096 Jul 26 18:23 books
-rwxrwxr-x 1 ubuntu ubuntu 16384 Aug 14 05:32 celerybeat-schedule
drwxrwxr-x 5 ubuntu ubuntu 4096 Jul 26 18:23 chats
-rw-rw-r-- 1 ubuntu www-data 2120704 Aug 17 23:07 db.sqlite3
-rwxrwxr-x 1 ubuntu ubuntu 18446 Jul 15 19:21 edits.txt
-rwxrwxr-x 1 ubuntu ubuntu 656 Apr 26 2020 manage.py
drwxrwxr-x 3 ubuntu ubuntu 4096 Jul 24 03:20 media
drwxrwxr-x 5 ubuntu ubuntu 4096 Jul 24 06:05 myprojectenv
drwxrwxr-x 5 ubuntu ubuntu 4096 Jul 26 18:24 pages
drwxrwxr-x 4 ubuntu www-data 4096 Jul 26 05:22 readbus_project
drwxrwxr-x 8 ubuntu ubuntu 4096 Jul 26 18:40 static
drwxrwxr-x 7 ubuntu ubuntu 4096 Jul 26 18:38 static2
drwxrwxr-x 2 ubuntu ubuntu 4096 Jul 24 03:23 supervisor
drwxrwxr-x 4 ubuntu ubuntu 4096 Jul 24 03:23 templates
drwxrwxr-x 5 ubuntu ubuntu 4096 Jul 26 18:24 users
-rwxrwxr-x 1 root root 0 Aug 5 05:43 vi

最佳答案

似乎您正在使用 python wsgi 并且您没有在项目的根节点上授予它服务器权限

error from comments

[autoindex:error] [pid 27528:tid 140136830449408] [client 103.119.165.25:64522] AH01276: Cannot serve directory /home/ubuntu/readingroots/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive


对于您的情况:
评论中的这个错误意味着您的服务器在端口 433 上看不到 wsgi
在您的配置中没有 WSGIScriptAlias , WSGIDaemonProcess或任何 433 conf ..
它应该在 433 服务器配置以及 80 中正确配置

对于可能解决此问题的其他人也可能有所帮助:
文档根目录 /home/ubuntu/readingroots没有 <Directory>标记自己,因此您需要确保它存在
像这样的东西:
<Directory /home/ubuntu/readingroots>
Require all granted
</Directory>

如果 wsgi 服务器本身尝试获取属于其他用户而不是运行工作程序的用户的文件,则可能会出现此问题,因此您需要修复任何权限问题
  • 转到 apache2 配置目录 /etc/apache2在 ubuntu - 你会找到一个名为 magicvars 的文件
  • 更改apache-run-user & apache-run-group您在 wsgi 服务中使用的内容
  • 授予该用户并在您的根目录上分组所有权限
    chown -R user:group *
  • 如果您使用其他用户而不是编辑用户,则向组成员添加写入前提
    chmod g+x *
    // or
    chmod 774 *
  • 如果您不是,请将您的用户添加到该组
    sudo usermod -a -G group user

  • I would recomend "NGNIX" as a proxy for wsgi python applications as I tried both and belive that apache2 is not a good friend of python

    关于apache - 403 禁止 : You don't have permission to access this resource. Apache/2.4.29 (Ubuntu) 服务器端口 443,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68698686/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com