1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- user www-data;
- worker_processes auto;
- error_log stderr error;
- #worker_rlimit_nofile 100000;
- #timer_resolution 1000ms;
- daemon off;
- events {
- worker_connections 65536;
- multi_accept off;
- }
- http {
- include /etc/nginx/mime.types;
- access_log off;
- server_tokens off;
- sendfile off;
- tcp_nopush off;
- tcp_nodelay on;
- keepalive_timeout 65s;
- keepalive_disable none;
- keepalive_requests 10000;
- php_ini_path /deploy/conf/php.ini;
- init_worker_by_php '
- global $pdo;
- $pdo = new PDO("mysql:host=tfb-database;dbname=hello_world", "benchmarkdbuser", "benchmarkdbpass", [
- PDO::ATTR_PERSISTENT => true
- ]);
-
- require "app.php";
- ';
- server {
- listen 8080 default_server reuseport;
- root /;
- index index.html;
- php_keepalive 100;
- location = /hello {
- add_header Content-Type text/plain;
- content_by_php '
- echo "Hello, World!";
- ';
- }
- location = /json {
- add_header Content-Type application/json;
- content_by_php '
- echo json_encode(["message" => "Hello, World!"]);
- ';
- }
-
- location = /fortune {
- add_header Content-Type "text/html; charset=UTF-8";
- content_by_php '
- fortune();
- ';
- }
- location = /db {
- add_header Content-Type application/json;
- content_by_php '
- db();
- ';
- }
- location /query {
- add_header Content-Type application/json;
- content_by_php '
- $_GET = ngx::query_args();
- query();
- ';
- }
- location /update {
- add_header Content-Type application/json;
- content_by_php '
- $_GET = ngx::query_args();
- update();
- ';
- }
- # location = /info {
- # add_header Content-Type text/html;
- # content_by_php '
- # phpinfo();
- # ';
- # }
- }
- }
|