mirror of
				https://github.com/mashirozx/docker-php-nginx.git
				synced 2025-05-29 01:49:24 +08:00 
			
		
		
		
	Intial commit
This commit is contained in:
		
						commit
						c4677b0278
					
				
							
								
								
									
										4
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,4 @@ | |||||||
|  | FROM php:7.0-fpm | ||||||
|  | 
 | ||||||
|  | COPY config/php.ini /usr/local/etc/php/conf.d/custom.ini | ||||||
|  | ADD ./src/ /var/www/html/ | ||||||
							
								
								
									
										20
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,20 @@ | |||||||
|  | Docker PHP-FPM & Nginx setup | ||||||
|  | ============================ | ||||||
|  | Example PHP-FPM & Nginx setup for Docker using docker-compose. | ||||||
|  | 
 | ||||||
|  | Usage | ||||||
|  | ---- | ||||||
|  | Add this to your hosts file: | ||||||
|  | 
 | ||||||
|  |     127.0.0.1 docker-app.dev | ||||||
|  | 
 | ||||||
|  | Start the Docker containers: | ||||||
|  | 
 | ||||||
|  |     docker-compose up | ||||||
|  | 
 | ||||||
|  | See the PHP info on http://docker-app.dev | ||||||
|  | 
 | ||||||
|  | Resources & inspiration | ||||||
|  | ----------------------- | ||||||
|  | https://ejosh.co/de/2015/09/how-to-link-docker-containers-together | ||||||
|  | https://github.com/johanan/Ansible-and-Docker | ||||||
							
								
								
									
										56
									
								
								config/nginx.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								config/nginx.conf
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,56 @@ | |||||||
|  | server { | ||||||
|  | 	listen   80; ## listen for ipv4; this line is default and implied | ||||||
|  | 	listen   [::]:80 default ipv6only=on; ## listen for ipv6 | ||||||
|  | 
 | ||||||
|  | 	root /var/www/html; | ||||||
|  | 	index index.php index.html index.htm; | ||||||
|  | 
 | ||||||
|  | 	# Make site accessible from http://localhost/ | ||||||
|  | 	server_name docker-app.dev; | ||||||
|  | 
 | ||||||
|  | 	# Disable sendfile as per https://docs.vagrantup.com/v2/synced-folders/virtualbox.html | ||||||
|  | 	sendfile off; | ||||||
|  | 
 | ||||||
|  | 	# Add stdout logging | ||||||
|  | 
 | ||||||
|  | 	error_log /dev/stderr info; | ||||||
|  | 	access_log /dev/stdout; | ||||||
|  | 
 | ||||||
|  | 	location / { | ||||||
|  | 		# First attempt to serve request as file, then | ||||||
|  | 		# as directory, then fall back to index.html | ||||||
|  | 		try_files $uri $uri/ /index.php?q=$uri&$args; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	#error_page 404 /404.html; | ||||||
|  | 
 | ||||||
|  | 	# redirect server error pages to the static page /50x.html | ||||||
|  | 	# | ||||||
|  | 	error_page 500 502 503 504 /50x.html; | ||||||
|  | 	location = /50x.html { | ||||||
|  | 		root /usr/share/nginx/html; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | ||||||
|  | 	# | ||||||
|  | 	location ~ \.php$ { | ||||||
|  |         try_files $uri =404; | ||||||
|  | 		fastcgi_split_path_info ^(.+\.php)(/.+)$; | ||||||
|  | 		fastcgi_pass  fpm:9000; | ||||||
|  | 		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||||||
|  |         fastcgi_param SCRIPT_NAME $fastcgi_script_name; | ||||||
|  | 		fastcgi_index index.php; | ||||||
|  | 		include fastcgi_params; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  |     location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ { | ||||||
|  |         expires 5d; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 	# deny access to . files, for security | ||||||
|  | 	# | ||||||
|  | 	location ~ /\. { | ||||||
|  |         log_not_found off; | ||||||
|  |         deny all; | ||||||
|  | 	} | ||||||
|  | } | ||||||
							
								
								
									
										2
									
								
								config/php.ini
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								config/php.ini
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,2 @@ | |||||||
|  | [Date] | ||||||
|  | date.timezone="Europe/Amsterdam" | ||||||
							
								
								
									
										20
									
								
								docker-compose.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								docker-compose.yml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,20 @@ | |||||||
|  | appdata: | ||||||
|  |     image: debian:jessie | ||||||
|  |     volumes: | ||||||
|  |         - ./src:/var/www/html | ||||||
|  | 
 | ||||||
|  | fpm: | ||||||
|  |     build: . | ||||||
|  |     volumes_from: | ||||||
|  |         - appdata | ||||||
|  | 
 | ||||||
|  | nginx: | ||||||
|  |     image: nginx:1.9 | ||||||
|  |     links: | ||||||
|  |         - fpm | ||||||
|  |     volumes: | ||||||
|  |         - ./config/nginx.conf:/etc/nginx/conf.d/app.conf:ro | ||||||
|  |     volumes_from: | ||||||
|  |         - appdata | ||||||
|  |     ports: | ||||||
|  |         - 80:80 | ||||||
							
								
								
									
										2
									
								
								src/index.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								src/index.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,2 @@ | |||||||
|  | <?php | ||||||
|  | phpinfo(); | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user