diff --git a/README.md b/README.md index 9e52750..959d6b0 100644 --- a/README.md +++ b/README.md @@ -40,16 +40,20 @@ Tests for the application are stored here. Additional configuration for dev too ## Dev server -To start the built-in dev server, run +To start the built-in dev server on port `8080`, run composer start +If you have `docker-compose` available, it is adviced to use the provided docker stack. + ## Docker stack -To run the server inside docker, run +To run the stack with docker, run docker-compose up -d +This boots the application itself running under `php-fpm` on port 9000 (internally) and an `nginx` front-end listening on `8080`. + ## Nette Tester [Nette Tester](https://github.com/nette/tester/) is a lightweight alternative to [PHPUnit](https://phpunit.de/). diff --git a/docker-compose.yml b/docker-compose.yml index 1853391..b678d09 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,12 +7,17 @@ volumes: services: app: image: saleschamp/php - working_dir: /var/www - command: php -S 0.0.0.0:8080 -t public public/index.php + working_dir: /var/www/public + command: php-fpm environment: docker: "true" - ports: - - 8080:8080 volumes: - .:/var/www - logs:/var/www/logs + + www: + image: nginx:1.13 + volumes: + - ./www/nginx.conf:/etc/nginx/nginx.conf + ports: + - 8080:80 diff --git a/www/nginx.conf b/www/nginx.conf new file mode 100644 index 0000000..5b23f55 --- /dev/null +++ b/www/nginx.conf @@ -0,0 +1,42 @@ +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + gzip on; + + index index.php; + + server { + listen 80; + listen [::]:80; + + root /var/www/public/; + + location / { + try_files $uri $uri/ /index.php?$args; + } + + location ~ [^/]\.php(/|$) { + fastcgi_split_path_info ^(.+\.php)(/.+)$; + + include fastcgi_params; + + # Bypass the fact that try_files resets $fastcgi_path_info + # see: http://trac.nginx.org/nginx/ticket/321 + set $path_info $fastcgi_path_info; + fastcgi_param PATH_INFO $path_info; + + fastcgi_index index.php; + + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + + # HTTPoxy + fastcgi_param HTTP_PROXY ""; + + fastcgi_pass app:9000; + } + } +}