Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion frameworks/ngx-php/meta.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"display_name": "ngx-php",
"language": "PHP",
"type": "production",
"type": "tuned",
"engine": "nginx",
"description": "Embedded PHP scripting language module for nginx.",
"repo": "https://github.com/rryqszq4/ngx-php",
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