My recommendation is to remove the default site by removing the symlink in /etc/nginx/sites-enabled:
$ sudo rm /etc/nginx/sites-enabled/default
Then create your desired configuration in a new file, call it /etc/nginx/sites-available/your.host.name. Assuming you have your home page at /var/www/your.host.name, here's a very simple example:
server {
listen 80;
server_name your.host.name;
location / {
root /var/www/your.host.name;
index index.html;
}
}
Then create a symlink in /etc/nginx/sites-enabled:
$ sudo ln -s /etc/nginx/sites-available/your.host.name /etc/nginx/sites-enabled/your.host.name
Finally, restart nginx:
$ sudo /etc/init.d/nginx restart
Good luck.
If you have installed the nginx
package from the Ubuntu repositories, you will have two directories.
/etc/nginx/sites-enabled
and /etc/nginx/sites-available
.
In the main nginx configuration, /etc/nginx/nginx.conf
, you have the following line:
include /etc/nginx/sites-enabled/*.conf;
So basically to list all available virtualhosts, you can run the following command:
ls /etc/nginx/sites-available
To activate one of them, run the following command:
ln -s /etc/nginx/sites-available/www.example.org.conf /etc/nginx/sites-enabled/
The scripts that comes with Apache is basically just simple shell wrappers that does something similar as above.
After linking the files, remember to run sudo service nginx reload
/ service nginx reload
Best Answer
http://nginx.org/en/docs/http/request_processing.html