Tiro monedas al aire, pero hasta ahora nunca las pude agarrar.

Logo de Nginx
Logo de Nginx

Estuve leyendo mucho sobre Nginx y quería probarlo para ver si realmente tiene ventajas comparando con el servidor Apache. Según los reviews y las comparaciones tiene grandes ventajas en cuanto a menor consumo de recursos, muy recomendado para sitios estáticos, escalabilidad, etc.
OBS:

  • Usamos Debian Jessie de 64 bits.
  • Tener el repositorio jessie-backports.

Entramos a la terminal y tecleamos lo siguiente:
sudo aptitude update && sudo aptitude install nginx -t jessie-backports -y

Volvemos a escribir en la consola:
sudo nano /etc/nginx/sites-available/default

Cambiamos algunas cosas:
server {
listen 8080 default_server;
listen [::]:8080 default_server ipv6only=on;

# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;

root /var/www/html;

# Add index.php to the list if you are using PHP
index index.html index.htm;

server_name localhost;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
# fastcgi_pass unix:/var/run/php5-fpm.sock;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}

Guardamos el el archivo (Control + o) y luego lo cerramos (Control + x). Volvemos a teclear en la terminal:
sudo service nginx restart
sudo service nginx status

Sale por pantalla:
nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
Active: active (running) since dom 2015-08-09 20:43:08 PYT; 14min ago
Process: 5361 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 5358 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 5362 (nginx)
CGroup: /system.slice/nginx.service
    ├─5362 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
    ├─5363 nginx: worker process
    ├─5364 nginx: worker process
    ├─5365 nginx: worker process
    └─5366 nginx: worker process

Entramos a nuestro navegador favorito y entramos a un sitio que ya tenia:
http://localhost:8080/departamentos_paraguay/src/

OBS:

  • Como tengo apache2 en el puerto 80, Nginx esta utilizando el puerto 8080.
Nginx 1.9 en Debian Jessie
Nginx 1.9 en Debian Jessie

Fuente: Digital Ocean


Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *