Skip to content
9 changes: 0 additions & 9 deletions frameworks/ngx-php/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@
Pgsql::init();
define('JSON_DATA', json_decode(file_get_contents('/data/dataset.json'), true));

function guard()
{
if (!in_array(ngx_request_method(), ['POST', 'GET'])) {
ngx_header_set('Content-Type', 'text/plain');
echo 'Method Not Allowed';
ngx::_exit(405);
}
}

function baseline()
{
$sum = array_sum(ngx::query_args());
Expand Down
19 changes: 8 additions & 11 deletions frameworks/ngx-php/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ http {
server_tokens off;
msie_padding off;
etag off;
root /data;

types {
text/html html htm;
Expand Down Expand Up @@ -66,28 +67,25 @@ http {

init_worker_by_php 'require "app.php";';

access_by_php 'guard();';

server {
listen 8080 reuseport;
listen 8080 reuseport backlog=65536;

location =/baseline11 { content_by_php 'baseline();'; }
location =/pipeline { content_by_php 'pipeline();'; }
location =/upload { content_by_php 'upload();'; }
location =/async-db { content_by_php 'asyncDb();'; }
location =/upload { content_by_php 'upload();'; }

location /json/ { content_by_php 'json();'; }

location /static/ {
autoindex on;
root /data;
#autoindex on;
add_header Last-Modified '';
gzip_static on;
#open_file_cache max=1000 inactive=5m;
}
}

server {
listen 8081 ssl reuseport;
listen 8081 ssl reuseport backlog=65536;

ssl_certificate /certs/server.crt;
ssl_certificate_key /certs/server.key;
Expand All @@ -99,7 +97,7 @@ http {
}

server {
listen 8443 ssl reuseport;
listen 8443 ssl reuseport backlog=65536;
listen 8443 quic reuseport;
http2 on;
http3 on;
Expand All @@ -117,9 +115,8 @@ http {

location =/baseline2 { content_by_php 'baseline();'; }
location /static/ {
root /data;
add_header Last-Modified '';
gzip_static on;
#open_file_cache max=1000 inactive=5m;
}
}
}
Loading