my gorgeous friends on the internet.
I was doing something about Nginx for deploying my app made by Django, Postgresql, Gunicorn, Nginx, and DigitalOcean.
First of all, The project name in the Github gist is btre_project, but my app’s project name is pfc_calc. Considering the name dif, I created project folder by coping and pasting the line on the gist.
sudo nano /etc/nginx/sites-available/pfc_calc
And, copy the code and paste it into the file I just made.
server {
listen 80;
server_name 104.248.152.6;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/djangoadmin/pyapps/pfc_calc;
}
location /media/ {
root /home/djangoadmin/pyapps/pfc_calc;
}
location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
}
}
BUT, here is where I made a mistake and got an error
I was so foolish that I forgot to change btre_project to pfc_calc
sudo ln -s /etc/nginx/sites-available/btre_project /etc/nginx/sites-enabled
Because I noticed that mistake, I typed this line again.
sudo ln -s /etc/nginx/sites-available/pfc_calc /etc/nginx/sites-enabled
I thought it would be ok and my mistake was under the bridge, but it wouldn’t.
When I typed this line
sudo nginx -t
this error below showed up.
nginx: [emerg] open() "/etc/nginx/sites-enabled/btre_project" failed (2: No such file or directory) in /etc/nginx/nginx.conf:62
nginx: configuration file /etc/nginx/nginx.conf test failed
I think I needed to delete the file I mis-created when I typed
sudo ln -s /etc/nginx/sites-available/btre_project /etc/nginx/sites-enabled
Any help??
2
Answers
Below is the continuous code in the terminal
I think the issue is because it cannot resolve the symlink to the first conf you specified. If you can remove the
btre_project
inside/etc/nginx/sites-enabled
then you’re good to go.PS: I tested it on a fresh nginx install and was able to reproduce the exact error you have