1、DisallowedHost at /admin Invalid HTTP_HOST header: '119.45.124.33:8011'. You may need to add '119.45.124.33' to ALLOWED_HOSTS.
解决方法:
修改项目中的 setting.py 文件
ALLOWED_HOSTS = ['*'] #在这里请求的host添加了*
2、E45: 'readonly' option is set (add ! to override)
解决方案, :wq!
强制关闭文件后,在命令行里输入:sudo !!
后回车。
3、** Operational MODE: preforking+threaded *** failed to open python file wsgi.py unable to load app 0 (mountpoint='') (callable not found or import error) *** no app loaded. going in full dynamic mode ***
上述报错是由于uwsgi.ini 配置文件中的项目路径配置错误导致
chdir 是项目的绝对路径
wsgi-file 是wsgi.py相对于chdir路径的相对路径
例如:新建Django项目Test,绝对路径是 /home/user_001/Test,wsgi.py的路径是 /home/user_001/Test/Test/wsgi.py 。
那么配置如下:
chdir = /home/user_001/Test
# 注意Test前不要加 /
wsgi-file = Test/wsgi.py
4、Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
一般是etc/nginx/nginx.conf 配置不符合规则,使用 sudo nginx -t
检查
5、# nginx: [emerg] “server” directive is not allowed here
etc/nginx/nginx.conf 的配置中,server需要放在http里面
events {
...
}
http {
...
server {
...
}
}