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
2 changes: 1 addition & 1 deletion frameworks/ngx-php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php >/dev/null && \
zlib1g-dev libpcre3-dev libargon2-dev libsodium-dev libkrb5-dev \
php8.4-cli php8.4-dev libphp8.4-embed php8.4-pgsql >/dev/null

ARG NGINX_VERSION=1.30.0
ARG NGINX_VERSION=1.30.4

RUN git clone -b v0.0.30 --single-branch --depth 1 https://github.com/rryqszq4/ngx-php.git >/dev/null
#RUN git clone -b master --recursive --single-branch --depth 1 https://github.com/cloudflare/ngx_brotli.git
Expand Down
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