From: Nicolas Boisselier Date: Thu, 4 Jan 2018 23:02:58 +0000 (+0000) Subject: lib/php/db/config.php X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=41ca4a9dcc5f93c0d90773f0dab76c6af0ee52d8;p=nb.git lib/php/db/config.php --- diff --git a/lib/php/db/config.php b/lib/php/db/config.php index d4354fa1..df5dd195 100644 --- a/lib/php/db/config.php +++ b/lib/php/db/config.php @@ -5,11 +5,11 @@ if (empty($_SERVER['HOME'])) $_SERVER['HOME'] = ''; $DB_CONFS = array_merge([], # ::ROOT_DIR - [ - Db::ROOT_DIR.'/etc/dbq.yml', - Db::ROOT_DIR.'/etc/dbq.yaml', - Db::ROOT_DIR.'/etc/dbq.php', - ], +# NB 04.01.18 [ +# NB 04.01.18 Db::ROOT_DIR.'/etc/dbq.yml', +# NB 04.01.18 Db::ROOT_DIR.'/etc/dbq.yaml', +# NB 04.01.18 Db::ROOT_DIR.'/etc/dbq.php', +# NB 04.01.18 ], (array)glob(Db::ROOT_DIR.'/etc/dbq/*.yml'), (array)glob(Db::ROOT_DIR.'/etc/dbq/*.yaml'), (array)glob(Db::ROOT_DIR.'/etc/dbq/*.php'), diff --git a/lib/postgres/function-show_create_table.sql b/lib/postgres/function-show_create_table.sql deleted file mode 100644 index ccdf3803..00000000 --- a/lib/postgres/function-show_create_table.sql +++ /dev/null @@ -1,77 +0,0 @@ --- CREATE OR REPLACE FUNCTION generate_create_table_statement(p_table_name varchar) -CREATE OR REPLACE FUNCTION show_create_table(p_table_name varchar) - RETURNS text AS -$BODY$ -DECLARE - v_table_ddl text; - column_record record; -BEGIN - FOR column_record IN - SELECT -(SELECT 1 FROM pg_index i WHERE a.attrelid = i.indrelid AND a.attnum = ANY(i.indkey) AND i.indrelid = b.relname::regclass AND i.indisprimary) as pk, - b.nspname as schema_name, - b.relname as table_name, - a.attname as column_name, - pg_catalog.format_type(a.atttypid, a.atttypmod) as column_type, - CASE WHEN - (SELECT substring(pg_catalog.pg_get_expr(d.adbin, d.adrelid) for 128) - FROM pg_catalog.pg_attrdef d - WHERE d.adrelid = a.attrelid AND d.adnum = a.attnum AND a.atthasdef) IS NOT NULL THEN - 'DEFAULT '|| (SELECT substring(pg_catalog.pg_get_expr(d.adbin, d.adrelid) for 128) - FROM pg_catalog.pg_attrdef d - WHERE d.adrelid = a.attrelid AND d.adnum = a.attnum AND a.atthasdef) - ELSE - '' - END as column_default_value, - CASE WHEN a.attnotnull = true THEN - 'NOT NULL' - ELSE - 'NULL' - END as column_not_null, - a.attnum as attnum, - e.max_attnum as max_attnum - FROM - pg_catalog.pg_attribute a - INNER JOIN - (SELECT c.oid, - n.nspname, - c.relname - FROM pg_catalog.pg_class c - LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace - WHERE c.relname ~ ('^('||p_table_name||')$') - AND pg_catalog.pg_table_is_visible(c.oid) - ORDER BY 2, 3) b - ON a.attrelid = b.oid - INNER JOIN - (SELECT - a.attrelid, - max(a.attnum) as max_attnum - FROM pg_catalog.pg_attribute a - WHERE a.attnum > 0 - AND NOT a.attisdropped - GROUP BY a.attrelid) e - ON a.attrelid=e.attrelid - WHERE a.attnum > 0 - AND NOT a.attisdropped - ORDER BY a.attnum - LOOP - IF column_record.attnum = 1 THEN - v_table_ddl:='CREATE TABLE '||column_record.schema_name||'.'||column_record.table_name||' ('; - ELSE - v_table_ddl:=v_table_ddl||','; - END IF; - - IF column_record.attnum <= column_record.max_attnum THEN - v_table_ddl:=v_table_ddl||chr(10)|| - ' '||column_record.column_name||' '||column_record.column_type||' '||column_record.column_default_value||' '||column_record.column_not_null; - END IF; - IF column_record.pk = 1 THEN - v_table_ddl:=v_table_ddl||' PRIMARY KEY'; - END IF; - END LOOP; - - v_table_ddl:=v_table_ddl||chr(10)||');'; - RETURN v_table_ddl; -END; -$BODY$ - LANGUAGE 'plpgsql' COST 100.0 SECURITY INVOKER; diff --git a/lib/postgres/function/show_create_table.sql b/lib/postgres/function/show_create_table.sql new file mode 100644 index 00000000..ccdf3803 --- /dev/null +++ b/lib/postgres/function/show_create_table.sql @@ -0,0 +1,77 @@ +-- CREATE OR REPLACE FUNCTION generate_create_table_statement(p_table_name varchar) +CREATE OR REPLACE FUNCTION show_create_table(p_table_name varchar) + RETURNS text AS +$BODY$ +DECLARE + v_table_ddl text; + column_record record; +BEGIN + FOR column_record IN + SELECT +(SELECT 1 FROM pg_index i WHERE a.attrelid = i.indrelid AND a.attnum = ANY(i.indkey) AND i.indrelid = b.relname::regclass AND i.indisprimary) as pk, + b.nspname as schema_name, + b.relname as table_name, + a.attname as column_name, + pg_catalog.format_type(a.atttypid, a.atttypmod) as column_type, + CASE WHEN + (SELECT substring(pg_catalog.pg_get_expr(d.adbin, d.adrelid) for 128) + FROM pg_catalog.pg_attrdef d + WHERE d.adrelid = a.attrelid AND d.adnum = a.attnum AND a.atthasdef) IS NOT NULL THEN + 'DEFAULT '|| (SELECT substring(pg_catalog.pg_get_expr(d.adbin, d.adrelid) for 128) + FROM pg_catalog.pg_attrdef d + WHERE d.adrelid = a.attrelid AND d.adnum = a.attnum AND a.atthasdef) + ELSE + '' + END as column_default_value, + CASE WHEN a.attnotnull = true THEN + 'NOT NULL' + ELSE + 'NULL' + END as column_not_null, + a.attnum as attnum, + e.max_attnum as max_attnum + FROM + pg_catalog.pg_attribute a + INNER JOIN + (SELECT c.oid, + n.nspname, + c.relname + FROM pg_catalog.pg_class c + LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace + WHERE c.relname ~ ('^('||p_table_name||')$') + AND pg_catalog.pg_table_is_visible(c.oid) + ORDER BY 2, 3) b + ON a.attrelid = b.oid + INNER JOIN + (SELECT + a.attrelid, + max(a.attnum) as max_attnum + FROM pg_catalog.pg_attribute a + WHERE a.attnum > 0 + AND NOT a.attisdropped + GROUP BY a.attrelid) e + ON a.attrelid=e.attrelid + WHERE a.attnum > 0 + AND NOT a.attisdropped + ORDER BY a.attnum + LOOP + IF column_record.attnum = 1 THEN + v_table_ddl:='CREATE TABLE '||column_record.schema_name||'.'||column_record.table_name||' ('; + ELSE + v_table_ddl:=v_table_ddl||','; + END IF; + + IF column_record.attnum <= column_record.max_attnum THEN + v_table_ddl:=v_table_ddl||chr(10)|| + ' '||column_record.column_name||' '||column_record.column_type||' '||column_record.column_default_value||' '||column_record.column_not_null; + END IF; + IF column_record.pk = 1 THEN + v_table_ddl:=v_table_ddl||' PRIMARY KEY'; + END IF; + END LOOP; + + v_table_ddl:=v_table_ddl||chr(10)||');'; + RETURN v_table_ddl; +END; +$BODY$ + LANGUAGE 'plpgsql' COST 100.0 SECURITY INVOKER; diff --git a/lib/postgres/functions.sql b/lib/postgres/functions.sql index 6fbe9041..1e139777 100644 --- a/lib/postgres/functions.sql +++ b/lib/postgres/functions.sql @@ -27,37 +27,7 @@ RETURNS TEXT $$; */ -DROP FUNCTION IF EXISTS STRFTIME(format text,sdate text); -CREATE OR REPLACE FUNCTION STRFTIME(format text,sdate text) -RETURNS text AS $$ -SELECT to_char(sdate::date,format) -$$ LANGUAGE sql; - -DROP FUNCTION IF EXISTS DATE(sdate text, sinterval text); -CREATE OR REPLACE FUNCTION DATE(sdate text DEFAULT 'now', sinterval text DEFAULT '0 seconds') -RETURNS date AS $$ -SELECT to_char(sdate::date + sinterval::interval,'YYYY-MM-DD')::date; -$$ LANGUAGE sql; - --- NB 22.06.16 CREATE OR REPLACE FUNCTION GROUP_CONCAT(anyarray, sep text DEFAULT ',', nullstr text DEFAULT '') --- NB 22.06.16 RETURNS text AS $$ --- NB 22.06.16 SELECT array_to_string( ARRAY( SELECT coalesce(v::text, $3) FROM unnest($1) g(v) ), $2 ) --- NB 22.06.16 $$ LANGUAGE sql; - -CREATE OR REPLACE FUNCTION GROUP_CONCAT(str text,sep text DEFAULT ',', nullstr text DEFAULT '') -RETURNS text AS $$ -SELECT array_to_string(array_agg(coalesce(str,nullstr)),sep) -$$ LANGUAGE sql; - -DROP FUNCTION IF EXISTS CIDR_RANGE(cidr text, ip text); -CREATE OR REPLACE FUNCTION CIDR_RANGE(cidr text, ip text) -RETURNS bool AS $$ -SELECT ip::inet << cidr::cidr -$$ LANGUAGE sql; - --- NB 21.06.16 CREATE AGGREGATE GROUP_CONCAT(field,sep=',') --- NB 21.06.16 sfunc = array_append, --- NB 21.06.16 stype = anyarray, --- NB 21.06.16 initcond = '{}' --- NB 21.06.16 -- return array_to_string(array_agg(field),sep) --- NB 21.06.16 } + + + + diff --git a/lib/postgres/geo.sql b/lib/postgres/geo.sql new file mode 100644 index 00000000..655caf0b --- /dev/null +++ b/lib/postgres/geo.sql @@ -0,0 +1,49 @@ +-- geonameid : integer id of record in geonames database +-- name : name of geographical point (utf8) varchar(200) +-- asciiname : name of geographical point in plain ascii characters, varchar(200) +-- alternatenames : alternatenames, comma separated, ascii names automatically transliterated, convenience attribute from alternatename table, varchar(10000) +-- latitude : latitude in decimal degrees (wgs84) +-- longitude : longitude in decimal degrees (wgs84) +-- feature class : see http://www.geonames.org/export/codes.html, char(1) +-- feature code : see http://www.geonames.org/export/codes.html, varchar(10) +-- country code : ISO-3166 2-letter country code, 2 characters +-- cc2 : alternate country codes, comma separated, ISO-3166 2-letter country code, 200 characters +-- admin1 code : fipscode (subject to change to iso code), see exceptions below, see file admin1Codes.txt for display names of this code; varchar(20) +-- admin2 code : code for the second administrative division, a county in the US, see file admin2Codes.txt; varchar(80) +-- admin3 code : code for third level administrative division, varchar(20) +-- admin4 code : code for fourth level administrative division, varchar(20) +-- population : bigint (8 byte int) +-- elevation : in meters, integer +-- dem : digital elevation model, srtm3 or gtopo30, average elevation of 3''x3'' (ca 90mx90m) or 30''x30'' (ca 900mx900m) area in meters, integer. srtm processed by cgiar/ciat. +-- timezone : the iana timezone id (see file timeZone.txt) varchar(40) +-- modification date : date of last modification in yyyy-MM-dd format +DROP TABLE IF EXISTS geo; +CREATE TABLE IF NOT EXISTS geo ( + id bigint PRIMARY KEY, + name varchar(200), + asciiname varchar(200), + altnames varchar(10000), + latitude numeric(7,4), + longitude numeric(7,4), + feature_class char(1), + feature_code varchar(10), + country char(2), + cc2 varchar(200), + admin1 varchar(20), + admin2 varchar(80), + admin3 varchar(20), + admin4 varchar(20), + population bigint, + elevation integer, + dem integer, + timezone varchar(40), + updated date +); +GRANT ALL ON ALL TABLES IN SCHEMA public TO www; +GRANT ALL ON ALL TABLES IN SCHEMA public TO nico; +GRANT ALL ON ALL TABLES IN SCHEMA public TO root; +CREATE INDEX IF NOT EXISTS geo_country_idx ON geo (country); +BEGIN TRANSACTION; +DELETE FROM geo; +COPY geo FROM PROGRAM 'curl -s http://download.geonames.org/export/dump/allCountries.zip | zcat' WITH (format 'text', NULL ''); +COMMIT; diff --git a/lib/postgres/host.sql b/lib/postgres/host.sql new file mode 100644 index 00000000..f1e3bd1a --- /dev/null +++ b/lib/postgres/host.sql @@ -0,0 +1,7 @@ +DROP TABLE IF EXISTS host; +CREATE VIEW host AS + SELECT host,LEFT(CAST(MAX(updated) AS TEXT),19) as updated + FROM host_info + GROUP BY host +; +GRANT ALL ON hostGRANT ALL ON ALL TABLES IN SCHEMA public TO TO nico,www; diff --git a/lib/postgres/host_info.sql b/lib/postgres/host_info.sql new file mode 100644 index 00000000..18b4ab59 --- /dev/null +++ b/lib/postgres/host_info.sql @@ -0,0 +1,14 @@ +DROP TABLE IF EXISTS host_info; +CREATE TABLE host_info ( + host VARCHAR(200), + key VARCHAR(100) NOT NULL, + val VARCHAR(500) NOT NULL, + updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + -- PRIMARY KEY (host,key,updated) + PRIMARY KEY (host,key) +); +CREATE INDEX IF NOT EXISTS host_info_host ON host_info USING btree (host); +CREATE INDEX IF NOT EXISTS host_info_key ON host_info USING btree (key); +CREATE INDEX IF NOT EXISTS host_info_val ON host_info USING btree (val); +CREATE INDEX IF NOT EXISTS host_info_updated ON host_info USING btree (updated); +GRANT ALL ON host_info TO nico,www; diff --git a/lib/postgres/zipcode b/lib/postgres/zipcode new file mode 100755 index 00000000..dcf671fb --- /dev/null +++ b/lib/postgres/zipcode @@ -0,0 +1,19 @@ +#!/usr/bin/env perl +use strict; +use warnings; +@ARGV = ('curl -s http://download.geonames.org/export/zip/allCountries.zip | zcat |'); +#exec($ARGV[0]); exit; + +while (<>) { + chomp($_); + s,\\,\\\\,g; # fix error + @_ = split("\t",$_); + push @_,0 if (@_<12); + + $_ = $_[0]; + $_[0] = $_[1]; + $_[1] = $_; + + + print join ("\t",@_)."\n"; +} diff --git a/lib/postgres/zipcode.sql b/lib/postgres/zipcode.sql new file mode 100644 index 00000000..103a7cee --- /dev/null +++ b/lib/postgres/zipcode.sql @@ -0,0 +1,27 @@ +DROP TABLE IF EXISTS zipcode; +CREATE TABLE IF NOT EXISTS zipcode ( + id varchar(20), + country varchar(2), + name varchar(180), + state varchar(100), + state_code varchar(20), + province varchar(100), + province_code varchar(20), + community varchar(100), + community_code varchar(20), + latitude numeric(7,4), + longitude numeric(7,4), + accuracy smallint + -- PRIMARY KEY(id,country) +); +GRANT ALL ON ALL TABLES IN SCHEMA public TO www; +GRANT ALL ON ALL TABLES IN SCHEMA public TO nico; +GRANT ALL ON ALL TABLES IN SCHEMA public TO root; +CREATE INDEX IF NOT EXISTS zipcode_id_idx ON zipcode (id); +CREATE INDEX IF NOT EXISTS zipcode_country_countryx ON zipcode (country); +CREATE INDEX IF NOT EXISTS zipcode_name_namex ON zipcode (name); +-- \copy zipcode from stdin with delimiter E'\t' null as ''; +BEGIN TRANSACTION; +DELETE FROM zipcode; +COPY zipcode FROM stdin WITH (format 'text'); +COMMIT; diff --git a/share/sql/geo.sql b/share/sql/geo.sql deleted file mode 100644 index 655caf0b..00000000 --- a/share/sql/geo.sql +++ /dev/null @@ -1,49 +0,0 @@ --- geonameid : integer id of record in geonames database --- name : name of geographical point (utf8) varchar(200) --- asciiname : name of geographical point in plain ascii characters, varchar(200) --- alternatenames : alternatenames, comma separated, ascii names automatically transliterated, convenience attribute from alternatename table, varchar(10000) --- latitude : latitude in decimal degrees (wgs84) --- longitude : longitude in decimal degrees (wgs84) --- feature class : see http://www.geonames.org/export/codes.html, char(1) --- feature code : see http://www.geonames.org/export/codes.html, varchar(10) --- country code : ISO-3166 2-letter country code, 2 characters --- cc2 : alternate country codes, comma separated, ISO-3166 2-letter country code, 200 characters --- admin1 code : fipscode (subject to change to iso code), see exceptions below, see file admin1Codes.txt for display names of this code; varchar(20) --- admin2 code : code for the second administrative division, a county in the US, see file admin2Codes.txt; varchar(80) --- admin3 code : code for third level administrative division, varchar(20) --- admin4 code : code for fourth level administrative division, varchar(20) --- population : bigint (8 byte int) --- elevation : in meters, integer --- dem : digital elevation model, srtm3 or gtopo30, average elevation of 3''x3'' (ca 90mx90m) or 30''x30'' (ca 900mx900m) area in meters, integer. srtm processed by cgiar/ciat. --- timezone : the iana timezone id (see file timeZone.txt) varchar(40) --- modification date : date of last modification in yyyy-MM-dd format -DROP TABLE IF EXISTS geo; -CREATE TABLE IF NOT EXISTS geo ( - id bigint PRIMARY KEY, - name varchar(200), - asciiname varchar(200), - altnames varchar(10000), - latitude numeric(7,4), - longitude numeric(7,4), - feature_class char(1), - feature_code varchar(10), - country char(2), - cc2 varchar(200), - admin1 varchar(20), - admin2 varchar(80), - admin3 varchar(20), - admin4 varchar(20), - population bigint, - elevation integer, - dem integer, - timezone varchar(40), - updated date -); -GRANT ALL ON ALL TABLES IN SCHEMA public TO www; -GRANT ALL ON ALL TABLES IN SCHEMA public TO nico; -GRANT ALL ON ALL TABLES IN SCHEMA public TO root; -CREATE INDEX IF NOT EXISTS geo_country_idx ON geo (country); -BEGIN TRANSACTION; -DELETE FROM geo; -COPY geo FROM PROGRAM 'curl -s http://download.geonames.org/export/dump/allCountries.zip | zcat' WITH (format 'text', NULL ''); -COMMIT; diff --git a/share/sql/host.sql b/share/sql/host.sql deleted file mode 100644 index f1e3bd1a..00000000 --- a/share/sql/host.sql +++ /dev/null @@ -1,7 +0,0 @@ -DROP TABLE IF EXISTS host; -CREATE VIEW host AS - SELECT host,LEFT(CAST(MAX(updated) AS TEXT),19) as updated - FROM host_info - GROUP BY host -; -GRANT ALL ON hostGRANT ALL ON ALL TABLES IN SCHEMA public TO TO nico,www; diff --git a/share/sql/host_info.sql b/share/sql/host_info.sql deleted file mode 100644 index 18b4ab59..00000000 --- a/share/sql/host_info.sql +++ /dev/null @@ -1,14 +0,0 @@ -DROP TABLE IF EXISTS host_info; -CREATE TABLE host_info ( - host VARCHAR(200), - key VARCHAR(100) NOT NULL, - val VARCHAR(500) NOT NULL, - updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - -- PRIMARY KEY (host,key,updated) - PRIMARY KEY (host,key) -); -CREATE INDEX IF NOT EXISTS host_info_host ON host_info USING btree (host); -CREATE INDEX IF NOT EXISTS host_info_key ON host_info USING btree (key); -CREATE INDEX IF NOT EXISTS host_info_val ON host_info USING btree (val); -CREATE INDEX IF NOT EXISTS host_info_updated ON host_info USING btree (updated); -GRANT ALL ON host_info TO nico,www; diff --git a/share/sql/zipcode b/share/sql/zipcode deleted file mode 100755 index dcf671fb..00000000 --- a/share/sql/zipcode +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; -@ARGV = ('curl -s http://download.geonames.org/export/zip/allCountries.zip | zcat |'); -#exec($ARGV[0]); exit; - -while (<>) { - chomp($_); - s,\\,\\\\,g; # fix error - @_ = split("\t",$_); - push @_,0 if (@_<12); - - $_ = $_[0]; - $_[0] = $_[1]; - $_[1] = $_; - - - print join ("\t",@_)."\n"; -} diff --git a/share/sql/zipcode.sql b/share/sql/zipcode.sql deleted file mode 100644 index 103a7cee..00000000 --- a/share/sql/zipcode.sql +++ /dev/null @@ -1,27 +0,0 @@ -DROP TABLE IF EXISTS zipcode; -CREATE TABLE IF NOT EXISTS zipcode ( - id varchar(20), - country varchar(2), - name varchar(180), - state varchar(100), - state_code varchar(20), - province varchar(100), - province_code varchar(20), - community varchar(100), - community_code varchar(20), - latitude numeric(7,4), - longitude numeric(7,4), - accuracy smallint - -- PRIMARY KEY(id,country) -); -GRANT ALL ON ALL TABLES IN SCHEMA public TO www; -GRANT ALL ON ALL TABLES IN SCHEMA public TO nico; -GRANT ALL ON ALL TABLES IN SCHEMA public TO root; -CREATE INDEX IF NOT EXISTS zipcode_id_idx ON zipcode (id); -CREATE INDEX IF NOT EXISTS zipcode_country_countryx ON zipcode (country); -CREATE INDEX IF NOT EXISTS zipcode_name_namex ON zipcode (name); --- \copy zipcode from stdin with delimiter E'\t' null as ''; -BEGIN TRANSACTION; -DELETE FROM zipcode; -COPY zipcode FROM stdin WITH (format 'text'); -COMMIT; diff --git a/www/dbq/etc/nginx/default.conf b/www/dbq/etc/nginx/default.conf deleted file mode 100644 index 0760e166..00000000 --- a/www/dbq/etc/nginx/default.conf +++ /dev/null @@ -1,69 +0,0 @@ -server { - listen 1973 default_server; - server_name dbq dbq.*; - root /opt/nb/www/dbq/html; - index index.php index.html; - - charset utf-8; - - #access_log off; - #error_log /var/log/nginx/error.log error; - - #error_log /dev/stderr error; - #access_log /dev/stdout main; - sendfile off; - - client_max_body_size 100m; - - #--------------------------------------------------------------# - # Ignore - location = /favicon.ico { access_log off; log_not_found off; } - location = /robots.txt { access_log off; log_not_found off; } - #location ~ /\.well-known { - location /.well-known/ { - alias /sync/etc/certs/dbq.nbdom.net/web/.well-known/; - autoindex on; - break; - } - - #--------------------------------------------------------------# - # Deny - location ~ /\.ht { deny all; } - - #--------------------------------------------------------------# - # serve static files directly - #location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico)$ { - # access_log off; - # expires 30d; - #} - - #--------------------------------------------------------------# - # All to index.php - location / { - try_files $uri $uri/ /index.php?$query_string; - } - - #--------------------------------------------------------------# - # FastCGI - set $prod "1"; - if ($server_addr = '127.0.0.1') { - set $prod "0"; - } - - location ~ /index\.php$ { - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass unix:/var/run/php5-fpm.sock; - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_intercept_errors off; - fastcgi_buffer_size 16k; - fastcgi_buffers 4 16k; - - fastcgi_param DBQ_CONF_FILE $document_root/../../../etc/dbq/000-local.php; - fastcgi_param DBQ_PERM 0; -# NB 09.01.17 fastcgi_param DBQ_PARAM_DB ls; - fastcgi_param PRODUCTION $prod; - } - -} diff --git a/www/dbq/etc/nginx/default.conf.TODEL b/www/dbq/etc/nginx/default.conf.TODEL new file mode 100644 index 00000000..0760e166 --- /dev/null +++ b/www/dbq/etc/nginx/default.conf.TODEL @@ -0,0 +1,69 @@ +server { + listen 1973 default_server; + server_name dbq dbq.*; + root /opt/nb/www/dbq/html; + index index.php index.html; + + charset utf-8; + + #access_log off; + #error_log /var/log/nginx/error.log error; + + #error_log /dev/stderr error; + #access_log /dev/stdout main; + sendfile off; + + client_max_body_size 100m; + + #--------------------------------------------------------------# + # Ignore + location = /favicon.ico { access_log off; log_not_found off; } + location = /robots.txt { access_log off; log_not_found off; } + #location ~ /\.well-known { + location /.well-known/ { + alias /sync/etc/certs/dbq.nbdom.net/web/.well-known/; + autoindex on; + break; + } + + #--------------------------------------------------------------# + # Deny + location ~ /\.ht { deny all; } + + #--------------------------------------------------------------# + # serve static files directly + #location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico)$ { + # access_log off; + # expires 30d; + #} + + #--------------------------------------------------------------# + # All to index.php + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + #--------------------------------------------------------------# + # FastCGI + set $prod "1"; + if ($server_addr = '127.0.0.1') { + set $prod "0"; + } + + location ~ /index\.php$ { + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass unix:/var/run/php5-fpm.sock; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_intercept_errors off; + fastcgi_buffer_size 16k; + fastcgi_buffers 4 16k; + + fastcgi_param DBQ_CONF_FILE $document_root/../../../etc/dbq/000-local.php; + fastcgi_param DBQ_PERM 0; +# NB 09.01.17 fastcgi_param DBQ_PARAM_DB ls; + fastcgi_param PRODUCTION $prod; + } + +}