python/Django
[Django] nginx: [emerg] open() "/etc/nginx/proxy_params" failed (2: No such file or directory) in /etc/nginx/sites-enabled
http://portfolio.wonpaper.net
2023. 11. 20. 09:54
Centos7
Django
nginx
gunicorn
Django 와 nginx 웹서버와 연동하는 과정중에
nginx: [emerg] open() "/etc/nginx/proxy_params" failed (2: No such file or directory) in /etc/nginx/sites-enabled
와 같은 에러가 나면서 해당 proxy_params 설정 부분내용이 없다고 메세지가 나왔다.
1
2
3
4
5
6
7
8
9
|
(venv) [root@localhost alzssol_django]# sudo systemctl daemon-reload
(venv) [root@localhost alzssol_django]# sudo systemctl start gunicorn
(venv) [root@localhost alzssol_django]# sudo systemctl start nginx
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
(venv) [root@localhost alzssol_django]# sudo nginx -t
nginx: [emerg] open() "/etc/nginx/proxy_params" failed (2: No such file or directory) in /etc/nginx/sites-enabled/alzssol_django:12
nginx: configuration file /etc/nginx/nginx.conf test failed
|
cs |
[ /etc/nginx/sites-enabled/test_home ] - 필자의 test_home 계정의 설정파일
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
server {
listen 80;
server_name xxx.xxx.xxx.xxx
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /var/test_home;
}
location / {
#include proxy_params;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://unix:/var/test_home/run/gunicorn.sock;
}
}
|
cs |
14라인부터 17라인까지의 내용으로 추가하였다.