smallphp/small-static-http

By smallphp

Updated over 1 year ago

Image
0

32

small-static-http

small-static-http is a small http server written in php using openswoole to serve static files.

build args

  • memory_limit : Max allowed memory size
  • timezone : timezone for logs
  • user_id : user id for www-data user

volumes

  • /var/www : directory to serve
  • /etc/small-static-http.json : configuration file

configuration file

{
  "root-path": "/var/www",
  "index-files": ["index.html"],
  "not-found": {
    "page": "/not-found.html",
    "status": 404
  },
  "skip-hidden-files": true,
  "http": {
    "port": 80,
    "swoole": {
      "worker_num": 8,
      "backlog": 128
    }
  },
  "logs": [
    {
      "kind": "kernel",
      "type": "stdout",
      "format": "text"
    },
    {
      "kind": "access",
      "type": "file",
      "format": "json",
      "path": "/var/log/small-http-server/access.log"
    },
    {
      "kind": "error",
      "type": "http",
      "format": "json",
      "host": "127.0.0.1",
      "port": 9000,
      "protocol": "https"
    }
  ]
}

Docker-compose example

version: "3.7"

services:
   static-server:
       image: smallphp/small-static-http:latest
       ports:
          - 80:80
       volumes
          - ./config.json:/etc/small-static-http.json
          - /home/user/my-site:/var/www

Sources

Sources are located on framagit : https://framagit.org/small/small-static-http

Docker Pull Command

docker pull smallphp/small-static-http