wolverinn / stable-diffusion-multi-user

stable diffusion multi-user django server code with multi-GPU load balancing
https://image.stable-ai.tech/
GNU General Public License v3.0
304 stars 64 forks source link

为什么会出现403? #3

Open Marootc opened 1 year ago

Marootc commented 1 year ago

按照大佬的方法配置下去 当访问api的时候出现403?

wolverinn commented 1 year ago

一般是因为权限没给到位,apache服务器运行的时候是www-data用户身份而不是root用户。可以尝试以下方法:

sudo chgrp www-data /var/www
sudo chmod g+w /var/www
os.system("chmod -R 644 {}".format(main_path))
os.system("find {} -type d | xargs chmod 755".format(main_path))

最后,可以查看apache的错误日志来定位具体的问题,日志路径:/var/log/apache2/error.log

Marootc commented 1 year ago

access to /favicon.ico denied (filesystem path '/root/var') because search permissions are missing on a component of the path, referer: http://region-9.seetacloud.com:47763/txt2img

Marootc commented 1 year ago

@wolverinn access to /favicon.ico denied (filesystem path '/root/var') because search permissions are missing on a component of the path, referer: http://region-9.seetacloud.com:47763/txt2img 错误日志 还是显示403 我的用apache2 版 Apache/2.4.41 (Ubuntu)

Marootc commented 1 year ago

@wolverinn <VirtualHost *:6006> WSGIApplicationGroup %{GLOBAL}

WSGIScriptAlias / /root/var/www/sd_multi/wsgi.py

Alias /static/ /root/var/www/static/

<Directory /root/var/www/static>
    Require all granted
</Directory>

<Directory /root/var/www/sd_multi>
<Files wsgi.py>
    Require all granted
</Files>
</Directory>

WSGIPythonHome /root/var/www/venv

~ 这是自动生成的配置文件

wolverinn commented 1 year ago

你这个报错还是权限问题。/root/var 没给apache权限肯定读不到啊。参考这篇讲django部署到apache服务器的文章吧:https://www.jianshu.com/p/ad47ea981e3e