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 配置不符合規(guī)則,使用 sudo nginx -t檢查
5、# nginx: [emerg] “server” directive is not allowed here
etc/nginx/nginx.conf 的配置中,server需要放在http里面
events {
...
}
http {
...
server {
...
}
}