├── app └── public │ └── index.php ├── database └── .gitignore ├── docker-compose.yml ├── fpm ├── Dockerfile └── supervisord.conf ├── nginx ├── Dockerfile └── default.conf └── readme.md /app/public/index.php: -------------------------------------------------------------------------------- 1 | > /etc/nginx/nginx.conf 6 | 7 | CMD service nginx start -------------------------------------------------------------------------------- /nginx/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80 default_server; 3 | 4 | root /var/app/public; 5 | index index.php index.html; 6 | 7 | # serve static files directly 8 | location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ { 9 | access_log off; 10 | expires max; 11 | log_not_found off; 12 | } 13 | 14 | # unless the request is for a valid file (image, js, css, etc.), send to bootstrap 15 | if (!-e $request_filename) { 16 | rewrite ^/(.*)$ /index.php?/$1 last; 17 | break; 18 | } 19 | 20 | location / { 21 | try_files $uri $uri/ /index.php?$query_string; 22 | } 23 | 24 | location ~* \.php$ { 25 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 26 | fastcgi_pass fpm:9000; 27 | fastcgi_index index.php; 28 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 29 | include fastcgi_params; 30 | } 31 | 32 | location ~ /\.ht { 33 | deny all; 34 | } 35 | } -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Docker-PHP7 2 | 3 | A quick and easy way to setup your PHP application using Docker and docker-compose. This will setup a developement environment with PHP7-fpm, MariaDB and Nginx. 4 | 5 | ## Usage 6 | ~~~ 7 | git clone git@github.com:shameerc/docker-php7.git 8 | cd docker-php7 9 | docker-compose up 10 | ~~~ 11 | 12 | ### Structure 13 | 14 | ~~~ 15 | ├── app 16 | │   └── public 17 | │   └── index.php 18 | ├── database 19 | ├── docker-compose.yml 20 | ├── fpm 21 | │   ├── Dockerfile 22 | │   └── supervisord.conf 23 | ├── nginx 24 | │   ├── Dockerfile 25 | │   └── default.conf 26 | ~~~ 27 | 28 | - `app` is the directory for project files. Our Nginx config is pointing to `app/public`, which can be changed in `nginx/default.conf` 29 | - `database` is where MariDB will store the database files. 30 | 31 | 32 | ### How it works 33 | **[Read Here](https://blog.shameerc.com/2016/08/my-docker-setup-ubuntu-php7-fpm-nginx-and-mariadb)** 34 | --------------------------------------------------------------------------------