Servidor web en Debian 7 wheezy: Nginx, php, mysql y nodejs.

1 Instalando MySQL 5

Para instalar MySQL ejecutamos el siguiente comando:

apt-get install mysql-server mysql-client

Le asignamos una contrasena y nos acordaremos de ella.

2 Instalando Nginx

Descargar nginx: apt-get install nginx

Arrancar nginx: /etc/init.d/nginx start

The documento por defecto de nginx est’a en /usr/share/nginx/www.

3 Instalando PHP5-fpm

Instalar php5-fpm: apt-get install php5-fpm
4 Configurando Nginx

nano /etc/nginx/sites-available/default

[...]
server {
        listen   80; ## listen for ipv4; this line is default and implied
        listen   [::]:80 default_server ipv6only=on; ## listen for ipv6

        root /usr/share/nginx/www;
        index index.php index.html index.htm;

        # Make site accessible from http://localhost/
        server_name localhost;

        location / {
                try_files $uri $uri/ /index.html;
        }

        location /doc/ {
                alias /usr/share/doc/;
                autoindex on;
                allow 127.0.0.1;
                allow ::1;
                deny all;
        }

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /usr/share/nginx/www;
        }
        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }
        location ~ /\.ht {
                deny all;
        }
}
[...]

Uncomment both listen lines to make nginx listen on port 80 IPv4 and IPv6.

Guarda y recarga nginx:

/etc/init.d/nginx reload

Editar el php.ini con nano /etc/php5/fpm/php.ini

Y cambia el valor este a 0 cgi.fix_pathinfo=0:

 

[...]
; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI.  PHP's
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok
; what PATH_INFO is.  For more information on PATH_INFO, see the cgi specs.  Setting
; this to 1 will cause PHP CGI to fix its paths to conform to the spec.  A setting
; of zero causes PHP to behave as before.  Default is 1.  You should fix your scripts
; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.
; http://php.net/cgi.fix-pathinfo
cgi.fix_pathinfo=0
[...]

Recargar PHP-FPM: /etc/init.d/php5-fpm reload

Ahora crearemos un archivo info.php a modo de prueba en /usr/share/nginx/www:

nano /usr/share/nginx/www/info.php

<?php
phpinfo();
?>

Y ahora ponemos en el navegador la IP/info.php para ver el info.php  http://192.168.0.100/info.php

 

6 Instalar Nodejs CON repositorios

echo deb http://ftp.us.debian.org/debian wheezy-backports main >> /etc/apt/sources.list
apt-get update
apt-get install nodejs

NODEJS SEGMENTATION FAULT:

Solución

http://www.armhf.com/node-js-for-the-beaglebone-black/

# apt-get install python
# apt-get install build-essential
# wget http://nodejs.org/dist/v0.10.5/node-v0.10.5.tar.gz
# tar xzvf node-v0.10.5.tar.gz
         # cd node-v0.10.5
         # ./configure --without-snapshot
         # make      (tarda 35 minutos aprox)
# ./node -v
# make install



 

Deja un comentario