Last active
February 15, 2016 05:45
-
-
Save tierra/489eca32ff59e7e2d0f7 to your computer and use it in GitHub Desktop.
Modern phpBB Docker Configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.dockerignore | |
Dockerfile | |
docker-compose.yml | |
.git | |
.gitignore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This provides a way to override docker-compose process UID and | |
# GID so they are compatible with your local host user, and files | |
# created on the mounted application volume use your host user's | |
# file permissions. | |
USER_ID=1000 | |
GROUP_ID=1000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nginx: | |
build: ./nginx | |
links: | |
- php | |
ports: | |
- "80:80" | |
- "443:433" | |
volumes_from: | |
- php | |
env_file: | |
- ./docker-common.env | |
php: | |
build: . | |
links: | |
- db | |
- memcache | |
volumes: | |
- .:/app | |
env_file: | |
- ./docker-common.env | |
db: | |
image: mysql:5.7 | |
environment: | |
MYSQL_DATABASE: phpbb | |
MYSQL_ROOT_PASSWORD: phpbb | |
memcache: | |
image: memcached |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:8 | |
MAINTAINER Bryan Petty <[email protected]> | |
USER root | |
RUN DEBIAN_FRONTEND="noninteractive" apt-get update && apt-get install -y \ | |
php5-fpm php5-cli php5-curl php5-gd imagemagick php5-imagick \ | |
php5-mcrypt php5-memcache php5-mysql php5-twig php5-xdebug \ | |
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | |
ENV USER_ID www-data | |
ENV GROUP_ID www-data | |
COPY . /app | |
RUN chown -R $USER_ID:$GROUP_ID /app | |
VOLUME ["/app"] | |
EXPOSE 9000 | |
CMD ["/app/nginx/start-php-fpm.sh"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:8 | |
MAINTAINER Bryan Petty <[email protected]> | |
ENV NGINX_VERSION "1.9.11-1~jessie" | |
RUN DEBIAN_FRONTEND="noninteractive" \ | |
apt-key adv --keyserver "hkp://pgp.mit.edu:80" \ | |
--recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 \ | |
&& echo "deb http://nginx.org/packages/mainline/debian/ jessie nginx" >> /etc/apt/sources.list \ | |
&& apt-get update && apt-get install -y \ | |
ca-certificates nginx=${NGINX_VERSION} gettext-base ssl-cert \ | |
&& make-ssl-cert generate-default-snakeoil \ | |
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | |
ENV USER_ID www-data | |
ENV GROUP_ID www-data | |
COPY ./nginx.conf /etc/nginx/nginx.conf | |
COPY ./nginx-default.conf /etc/nginx/conf.d/default.conf | |
RUN ln -sf /dev/stdout /var/log/nginx/access.log \ | |
&& ln -sf /dev/stderr /var/log/nginx/error.log | |
EXPOSE 80 443 | |
CMD ["/app/nginx/start-nginx.sh"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
listen 443 ssl; | |
server_name phpbb.docker; | |
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem; | |
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key; | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
ssl_prefer_server_ciphers on; | |
ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH EDH+aRSA !aNULL !eNULL !LOW !MD5 !EXP !PSK !SRP !DSS !RC4 !aECDH +3DES 3DES"; | |
root /app/phpBB; | |
access_log /dev/stdout main; | |
index index.php index.html index.htm; | |
location / { | |
expires 1w; | |
} | |
location ~ /(config\.php|common\.php|includes|cache|files|store|images/avatars/upload) { | |
deny all; | |
} | |
location ~ /\.ht|/\.git { | |
deny all; | |
} | |
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
access_log off; | |
expires 2w; | |
} | |
location ~ [^/]\.php(/|$) { | |
fastcgi_split_path_info ^(.+?\.php)(/.*)$; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param PATH_INFO $fastcgi_path_info; | |
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; | |
try_files $fastcgi_script_name =404; | |
fastcgi_pass php:9000; | |
fastcgi_index index.php; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user nginx; | |
worker_processes 1; | |
error_log stderr warn; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | |
'$status $body_bytes_sent "$http_referer" ' | |
'"$http_user_agent" "$http_x_forwarded_for"'; | |
access_log /dev/stdout main; | |
sendfile on; | |
keepalive_timeout 65; | |
include /etc/nginx/conf.d/*.conf; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
id $USER_ID 2>/dev/null | |
if [ $? -ne 0 ]; then | |
addgroup --gid $GROUP_ID docker-nginx | |
adduser --uid $USER_ID --no-create-home --gecos "" --disabled-login \ | |
--gid $GROUP_ID docker-nginx | |
sed -e "s/user nginx/user docker-nginx docker-nginx/g" \ | |
-i /etc/nginx/nginx.conf | |
else | |
sed -e "s/user nginx/user $USER_ID $GROUP_ID/g" \ | |
-i /etc/nginx/nginx.conf | |
fi | |
exec nginx -g "daemon off;" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
sed -e "s/upload_max_filesize.*/upload_max_filesize = 50M/g" \ | |
-e "s/post_max_size.*/post_max_size = 50M/g" \ | |
-i /etc/php5/fpm/php.ini | |
sed -e "s|/var/run/php5-fpm\.sock|9000|g" \ | |
-e "s/user =.*/user = $USER_ID/g" \ | |
-e "s/group =.*/group = $GROUP_ID/g" \ | |
-e "s/;catch_workers_output.*/catch_workers_output = yes/g" \ | |
-i /etc/php5/fpm/pool.d/www.conf | |
exec php5-fpm -F -y "/etc/php5/fpm/php-fpm.conf" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment