Skip to content
Miguel Angel edited this page Apr 24, 2016 · 4 revisions

#Instalación del servidor

# apt-get install nginx php5-fpm php5-dev postgresql php5-pgsql

###Configurar NGINX:

# <editor> /etc/nginx/sites-available/cache

cache:

proxy_cache_path /tmp keys_zone=cacheSIGPA:10m max_size=256 inactive=12h;

server {
	listen 80;
	listen [::]:80 ipv6only=on;

	server_name localhost;
	root /var/www/html;
	index index.htm index.html index.php;
	charset utf-8;

	# Configuración de cache recomendada por H5BP con algunos arreglos

	location ~* \.(?:manifest|appcache|html?|xml|json)$ {
		expires 1M;
		add_header Cache-Control "public";
	}

	location ~* \.(?:rss|atom)$ {
		expires 1h;
		add_header Cache-Control "public";
	}

	location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
		expires 1M;
		add_header Cache-Control "public";
	}

	location ~* \.(?:css|js)$ {
		expires 1M;
		add_header Cache-Control "public";
	}

	location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ {
		expires 1M;
		add_header Cache-Control "public";
	}

	# ------------------------------------------

	error_page 405 =200 $uri;  # Permitir que el servidor envie contenido estático solicitado por POST

	location / {
		proxy_cache cacheSIGPA;
		include proxy_params;
		proxy_pass http://localhost:8080;
	}
}
# <editor> /etc/nginx/sites-available/default

default:

server {
	listen 8080;
	listen [::]:8080 ipv6only=on;

	server_name localhost;
	root /var/www/html;
	index index.htm index.html index.php;
	charset utf-8;

	location / {
		try_files $uri $uri/ =404;
	}

	location ~ \.php$
	{
		include fastcgi_params;
		fastcgi_split_path_info ^(.+\.php)(/.+)$;
		fastcgi_pass unix:/var/run/php5-fpm.sock;
		fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
		fastcgi_index index.php;
		fastcgi_buffers 8 16k;
		fastcgi_buffer_size 32k;
		fastcgi_connect_timeout 300;
		fastcgi_send_timeout 300;
		fastcgi_read_timeout 300;
	}
}
# chown -R <usuario>:www-data /var/www/html && chmod -R a=rwx,o-w /var/www/html
# ln -s /etc/nginx/sites-available/cache /etc/nginx/sites-enabled/
# /etc/init.d/nginx restart

###Configurar PostgreSQL

# passwd postgres
$ su postgres
$ createuser -s www-data
$ psql
postgres=# alter user "postgres" with encrypted password '<contraseña>';
postgres=# \q
# /etc/init.d/postgresql restart

 

#Instalación de SIGPA

$ rm -rf /var/www/html/*
$ git clone https://github.com/uptm/SIGPA.git /var/www/html
$ cd /var/www/html
$ <editor> lib/conexion.php
# dpkg -i wkhtmltox-0.12.2.1_linux-jessie-<arquitectura>.deb
$ su postgres
$ psql
postgres=# \i bd/sigpa.sql
postgres=# \q

En caso de que no se creen las planillas o los respaldos, se deben comprobar de nuevo los permisos de la carpeta del sitio:

# chown -R <usuario>:www-data /var/www/html && chmod -R a=rwx,o-w /var/www/html
Clone this wiki locally