Yiour
Yiour

Reputation: 187

File /etc/nginx/sites-available/mysite_nginx.conf is empty after symlink

I'm following this tutorial http://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html on configuring nginx for django projects. I have problems after making a symlink. The file mysite_nginx.conf is created in directory /etc/nginx/sites-enebled but there's nothing in it. What am I supposed to put there?

Upvotes: 0

Views: 3394

Answers (1)

nik_m
nik_m

Reputation: 12096

The file mysite_nginx.conf is created in directory /etc/nginx/sites-enabled but there's nothing in it.

You shouldn't create the mysite_nginx.conf file under this directory. You should create it under the /etc/nginx/sites-available.

Then, using this command:

sudo ln -s ~/path/to/your/mysite/mysite_nginx.conf /etc/nginx/sites-enabled/

you create a symbolic link under the /etc/nginx/sites-enabled directory. That's why, when you do a:

ls -a /etc/nginx/sites-enabled

you get an output like this (the --> refers to a symbolic link):

.... default --> /etc/nginx/sites-available/default
.... mysite_nginx.conf --> /etc/nginx/sites-available/mysite_nginx.conf

Remember, the main file (the one that has the actual data in there) is under the /etc/nginx/sites-available/ dir, whereas the /etc/nginx/sites-enabled holds only symlinks from the sites-available. That's a good practice to follow. You could, however, write the mysite_nginx.conf file, straight inside the /etc/nginx/sites-enabled but it's not recommended.

Upvotes: 2

Related Questions