Nginx (Engine X, pronounced [n-gen-x]) is a Web server asynchronous written by Igor Sysoev for the needs of a Russian site with very heavy traffic. It can be configured to act as a reverse proxy Web server and e-mail (IMAP/POP3) proxy server. Part of the documentation has been translated from Russian into English. Its sources are available under a BSD-style license.
Both deposits offer installers of nginx Server: the stable deposit and the deposit development. The stable deposit is provided by default; the newer versions are not available but their stability is proven. The deposit’s development offers newer versions. They are far from beings unstable but the tests performed are less driven and must therefore be avoided for production purposes. You will need to add this repository (ppa:nginx / development) If you want to use these versions.
You can also choose the packaging for your nginx. Indeed, nginx is offered in 3 packaging Offerors of the different lots of features. In doubt, choose package nginx.
Nginx configuration is modularized into multiple text-based configuration files you will find in the folder/etc/nginx:
nginx.conf: global server configuration file. Settings that are there must impact the entire server; you will earn normally not.
MIME.types: the list of MIME types resolved by the file extensions. This list indicates the nature of the files returned by the server (ex: this is a web page or this is an ogg video).
site-available: contains the configuration files of your sites or services (one file per pre-occupation/site/service). This folder is a deposit; configuration files that are there are not taken into account.
site-enabled: must contain symbolic links to the site-available files that you want to enable.
/etc/httpd/conf.d: location to apply the settings common to all sites. Can also be used in the same way as site-available (rename files “.conf” in “.disabled” to disable the sites).
Nginx and virtual hosts
Nginx includes an example of a virtuel1 host configuration) you can find in “etc / / nginx/sites-available/default.
If you want to change it, open the file/etc/nginx/sites-available/default (with administrator rights).
To configure your domain name (vhost), you can copy the default configuration of the vhost “default” and then make your changes. Example:
Then, change the configuration of your domain mondomaine.tld name by modifying the etc/nginx/sites-available/mondomaine.tld file.
The subdirectory ‘sites-available’ stores the vhosts but for Nginx take into account, you must enable them by creating a symbolic link in “/ etc/nginx/sites-enabled. For example:
sudo ln-s /etc/nginx/sites-available/mondomaine.tld /etc/nginx/sites-enabled/mondomaine.tld
It remains only to restart Nginx:
sudo /etc/init.d/nginx restart