I have achieved my "goal" several times before but am running into an issue I have not yet experienced before. I have a webserver setup with Nginx on Ubuntu 12.04 LTS. I have my system setup the way I normally would and am attempting to create a symbolic link for the site "virtual host" from the sites-available to the sites-enabled directory. Typically, this is achieve with the following from the primary nginx directory (as root):
ln -s /etc/nginx/sites-available/site.com /etc/nginx/sites-enabled/site.com
While I can move into the enabled directory and view the symbolic link has "worked", when I try and edit the file directly in the sites-enabled directory I see the file is blank and treated as a new file. As a result, my server does not work as expected and pages do not load. When I simply hard copy or hard link the file into the directory:
ln /etc/nginx/sites-available/site.com /etc/nginx/sites-enabled/site.com
It works without any issue. I however am stuck with two copies of the same file and no symbolic link.
What the heck gives?
Note: here is the structure of my current Nginx directory:
firstname.lastname@example.org:/etc/nginx# ls -l total 44 drwxr-xr-x 2 root root 4096 Mar 4 17:28 conf.d -rw-r--r-- 1 root root 964 Feb 12 08:41 fastcgi_params -rw-r--r-- 1 root root 2837 Feb 12 08:41 koi-utf -rw-r--r-- 1 root root 2223 Feb 12 08:41 koi-win -rw-r--r-- 1 root root 3463 Feb 12 08:41 mime.types -rw-r--r-- 1 root root 1022 Mar 4 21:15 nginx.conf -rw-r--r-- 1 root root 596 Feb 12 08:41 scgi_params drwxr-xr-x 2 root root 4096 Mar 4 21:15 sites-available drwxr-xr-x 2 root root 4096 Mar 4 21:19 sites-enabled -rw-r--r-- 1 root root 623 Feb 12 08:41 uwsgi_params -rw-r--r-- 1 root root 3610 Feb 12 08:41 win-utf
Thank you for your help ahead of time!
Showing the contents of the
sites-enabled folder with
email@example.com:/etc/nginx/sites-enabled# ls -l total 0 lrwxrwxrwx 1 root root 3 Mar 5 10:23 www -> www
So after help from the @Insyte and @Michael Hampton, I figured out how to reproduce my error occassionally. The scenario played out as follows:
firstname.lastname@example.org:/etc/nginx# cd sites-available email@example.com:/etc/nginx/sites-available# ls www firstname.lastname@example.org:/etc/nginx/sites-available# ln -s www /etc/nginx/sites-enabled/www email@example.com:/etc/nginx/sites-available# cd /etc/nginx/sites-enabled firstname.lastname@example.org:/etc/nginx/sites-enabled# ls -l total 0 lrwxrwxrwx 1 root root 3 Mar 5 10:48 www -> www
I am not aware of "why" but turns out that if I use full absolute paths each time then the issue does not exist.