mirror of
				https://github.com/mashirozx/docker-php-nginx.git
				synced 2025-05-29 01:49:24 +08:00 
			
		
		
		
	Made the upstream host/port a environment variable
This commit is contained in:
		
							parent
							
								
									e9ed481eaa
								
							
						
					
					
						commit
						fd5b5c096e
					
				| @ -14,3 +14,6 @@ nginx: | ||||
|         - appdata | ||||
|     ports: | ||||
|         - 80:80 | ||||
|     environment: | ||||
|     - UPSTREAM_HOST=fpm | ||||
|     - UPSTREAM_PORT=9000 | ||||
|  | ||||
| @ -1,3 +1,9 @@ | ||||
| FROM nginx:1.9 | ||||
| 
 | ||||
| COPY nginx.conf /etc/nginx/conf.d/app.conf | ||||
| 
 | ||||
| CMD /bin/bash -c envsubst < /etc/nginx/conf.d/app.conf.template > /etc/nginx/conf.d/app.conf && nginx -g 'daemon off;' | ||||
| 
 | ||||
| CMD sed -i 's/UPSTREAM_HOST/'"$UPSTREAM_HOST"'/g' /etc/nginx/conf.d/app.conf \ | ||||
|  && sed -i 's/UPSTREAM_PORT/'"$UPSTREAM_PORT"'/g' /etc/nginx/conf.d/app.conf \ | ||||
|  && nginx -g 'daemon off;' | ||||
|  | ||||
| @ -36,7 +36,7 @@ server { | ||||
| 	location ~ \.php$ { | ||||
|         try_files $uri =404; | ||||
| 		fastcgi_split_path_info ^(.+\.php)(/.+)$; | ||||
| 		fastcgi_pass  fpm:9000; | ||||
| 		fastcgi_pass  UPSTREAM_HOST:UPSTREAM_PORT; | ||||
| 		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||||
|         fastcgi_param SCRIPT_NAME $fastcgi_script_name; | ||||
| 		fastcgi_index index.php; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user