Mostrando las entradas con la etiqueta mysql. Mostrar todas las entradas
Mostrando las entradas con la etiqueta mysql. Mostrar todas las entradas

lunes, 10 de febrero de 2014

Nginx configuration and install

 

Nginx Install

In Debian it is advisable to use dotdeb repositories because it contains updated pre-compiled versions of Nginx. To do this place in /etc/apt/sources.list the repository packages.dotdeb.org, download and install their public key:
echo "deb http://packages.dotdeb.org squeeze all" >> /etc/apt/sources.list"
wget http://www.dotdeb.org/dotdeb.gpg
apt-key add dotdeb.gpg
apt-get update 
Then install Nginx with apt-get:
apt-get install nginx
On FreeBSD you can use pkg_add -vvv nginx (if you have FreeBSD 10 onward use pkg install nginx). You can also install it with make install clean from /usr/ports/www/nginx (only if you have ports installed an configured correctly). Nginx comes installed by default on OpenBSD starting from 5.2.

 

Configuration


Once installed we can find Nginx's configuration files on /etc/nginx. Those that uses apache will notice that Debian uses sites-available and sites-enabled folders (on /etc/nginx/). For those who doesn't have a clue about the folders in the first one you can find the configuration files of the "available" Web sites and on the second folder a symbolic link to the sites that are on sites-available. As you can infer if there is not a symbolic link from a web page on sites-available to sites-enabled Nginx will NOT server the site. Now i will show you an edited /etc/nginx/nginx.conf file and try to explain its options:
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;

events {
    worker_connections 768;
}

http {
  sendfile on;
  tcp_nopush on;
  tcp_nodelay on;
  types_hash_max_size 2048;
  server_tokens off;
  include /etc/nginx/mime.types;
  default_type application/octet-stream;
  access_log /var/log/nginx/access.log;
  error_log /var/log/nginx/error.log;
  gzip on;
  gzip_disable "msie6";
  gzip_vary on;
  gzip_types text/plain text/css application/x-javascript application/xml
  application/json image/png image/gif image/jpeg image/jpg;
  gzip_comp_level 6;
  gzip_buffers 16 8k;
  client_body_in_single_buffer on;
  client_body_buffer_size  1K;
  client_header_buffer_size 1k;
  client_max_body_size 1k;
  large_client_header_buffers 2 1k;
  client_body_timeout   10;
  client_header_timeout 10;
  keepalive_timeout     30;
  send_timeout          10;
  include /etc/nginx/conf.d/*.conf;
  include /etc/nginx/sites-enabled/*;
}