Game Development Reference
In-Depth Information
Installing nginx
The easiest way to install nginx is to use apt-get.
sudo apt-get install nginx
By default, nginx serves pages from /usr/share/nginx/www , but most Linux admins
tend to be more familiar with the location /var/www that Apache uses by default.
It does not matter where you keep the files, as long as you keep it well structured.
We will use /var/www in this chapter.
sudo mkdir /var/wwww
Inside this directory, we will create more directories that will hold various
virtual hosts. Virtual hosts are domain names that tell the web server about the
configuration for that requested domain. We will create a holding directory named
local and a directory named web that will hold the web files.
mkdir /var/www/local/web
Configuring virtual hosts
A virtual host is a specific website to be served off a given server. You may have
many virtual hosts to serve different domains (or subdomains) on one system.
Nginx uses the directory /etc/nginx/sites-available/ to store configuration
files for virtual hosts. At startup, it will check another directory, /etc/nginx/sites-
enabled/ , and usually, these files are symbolic links to the configuration files in
sites-available .
There should be a file called default , which is the default site that nginx serves.
We will remove the symbolic link of the default site, create a new configuration file
and symbolic link, and finally restart nginx. We will use the name nginpi , but feel
free to use any name you like for the virtual host.
sudo service nginx stop
sudo unlink /etc/nginx/sites-enabled/default
sudo touch /etc/nginx/sites-available/nginpi
Edit the new nginx configuration file found at /etc/nginx/nginx.conf and add the
following to it:
server {
listen 80;
root /var/www/local/web;
index index.html index.html;
}
 
Search WWH ::




Custom Search