docker run --rm -v ${PWD}/:/var/task -u 0 node:15-alpine sh --help
BusyBox v1.31.1 () multi-call binary.
Usage: sh [-/+OPTIONS] [-/+o OPT]... [-c 'SCRIPT' [ARG0 [ARGS]] / FILE [ARGS] / -s [ARGS]]
Unix shell interpreter
docker run --rm -v ${PWD}/:/var/task -u 0 node:15-alpine sh -c "cd /var/task && npm install && npm ci"
docker run --rm -v ${PWD}/:/var/task -u 0 --workdir="/var/task" node:15-alpine sh -c "npm install && npm ci
docker run --rm -v ${PWD}/:/var/task -u 0 --workdir="/var/task" node:15-alpine npm install && npm ci
version: '3'
services:
alpine-nginx:
image: nginx:stable-alpine
container_name: alpine-nginx
restart: "no"
links:
- composer-php
volumes:
- ./default.conf:/etc/nginx/conf.d/default.conf
- ./code:/code
ports:
- "80:80"
composer-php:
image: php:7-fpm
container_name: composer-php
restart: "no"
volumes:
- ./code:/code
ports:
- "9000:9000"
server {
listen 80;
listen [::]:80;
client_max_body_size 2M;
server_name domain.com admin.domain.com www.domain.com api.domain.com;
charset utf-8;
index index.php;
root /code;
gzip on;
location / {
try_files $uri $uri/ @phpindex;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass composer-php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
}
location @phpindex {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass composer-php:9000;
fastcgi_index index.php;
include fastcgi_params;
set $index_name /index.php;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $realpath_root$index_name;
fastcgi_param SCRIPT_NAME $index_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
}
location ~ /\.ht {
deny all;
}
}
<?php
header('X-PHP-REQUEST_METHOD: ' . $_SERVER['REQUEST_METHOD']);
echo $_SERVER['REQUEST_METHOD'];
echo "\n\n"
?>
zend@zbook:~$ curl -X GET http://api.domain.com/ -d ''
GET
zend@zbook:~$ curl -X POST http://api.domain.com/ -d ''
POST
zend@zbook:~$ curl -X DELETE http://api.domain.com/user/1000
DELETE
zend@zbook:~$ curl -X OPTIONS http://api.domain.com/user/1000
OPTIONS
zend@zbook:~$ curl -X PATCH http://api.domain.com/user/1000
PATCH
zend@zbook:~$ curl -I http://api.domain.com/user/1000
HTTP/1.1 200 OK
Server: nginx/1.20.1
Date: Sun, 18 Jul 2021 18:05:05 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Powered-By: PHP/7.4.21
X-PHP-REQUEST_METHOD: HEAD
zend@zbook:~$ curl -X PUT http://api.domain.com/user/1000
PUT
location /kibana/ {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_pass http://kibana_ip:5601/;
}