Nginx webserver with PHP 7.1 and composer
194
Ubuntu 16.04 Nginx PHP 7.1 Composer
this image contain php 7.1 extensions: php7.1 php7.1-fpm php7.1-bcmath php7.1-curl php7.1-gd php7.1-json php7.1-mbstring php7.1-mcrypt php7.1-mysql php7.1-pgsql php7.1-xml php7.1-zip php7.1-xsl
=====//=====//=====//=====//===== docker-compose.yml =====//=====//=====//=====//===== version: '2' services: web: image: juchem/phpwebserver ports: - "8080:80" volumes: - ./YOU/PROJECT/FOLDER:/var/www - ./YOU/NGINX/HOSTS/site-app.conf:/etc/nginx/conf.d/site-app.conf # Nginx site config - ./YOU/NGINX/HOSTS/LOGS:/var/log/nginx # Nginx logs files (access.txt and error.txt) tty: true
=====//=====//=====//=====//===== site-app.conf =====//=====//=====//=====//===== server {
listen 80;
server_name site.app;
root /var/www/public;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
fastcgi_index index.php;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
error_log /var/log/nginx/site_app_error.log;
access_log /var/log/nginx/site_app_access.log;
}
=====//=====//=====//=====//===== In windows open hosts file in C:\Windows\System32\drivers\etc with admin permissions Add this line: 127.0.0.1 site.app =====//=====//=====//=====//=====
=====//=====//=====//=====//===== In linux open /etc/hosts file sudo nano /etc/hosts Add this line: 127.0.0.1 site.app =====//=====//=====//=====//=====
=====//=====//=====//=====//===== Run compose file with docker-compose: docker-compose up -d # -d run container in background!
docker ps # list your containers running and get your ids
Access you container and navigate to /var/www folder and install laravel or another PHP framework docker exec -it container_id /bin/bash cd /var/www composer global require "laravel/installer" composer create-project --prefer-dist laravel/laravel .
Access the url http://site.app:8080/
:)
Content type
Image
Digest
Size
162.1 MB
Last updated
over 8 years ago
docker pull juchem/phpwebserver