Open Marootc opened 1 year ago
一般是因为权限没给到位,apache服务器运行的时候是www-data用户身份而不是root用户。可以尝试以下方法:
sudo chgrp www-data /var/www
sudo chmod g+w /var/www
gen_http_conf.py
中最后的几行授权命令是否成功运行了,如果没成功的话,可以手动在命令行里sudo运行一下。具体是文件里的这两行命令(手动运行的话记得加上sudo)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
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
@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)
@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>
~ 这是自动生成的配置文件
你这个报错还是权限问题。/root/var 没给apache权限肯定读不到啊。参考这篇讲django部署到apache服务器的文章吧:https://www.jianshu.com/p/ad47ea981e3e
按照大佬的方法配置下去 当访问api的时候出现403?