Skip to content

Commit 8e67e8e

Browse files
author
Luis Elizondo
committed
Reorganize configuration files
1 parent 4d51d42 commit 8e67e8e

24 files changed

+2412
-56
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

Dockerfile

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ ENV LC_ALL en_US.UTF-8
1111
# Update system
1212
RUN apt-get update && apt-get dist-upgrade -y
1313

14-
# Basic packages
15-
RUN apt-get -y install php5-fpm php5-mysql php-apc php5-imagick php5-imap php5-mcrypt php5-curl php5-cli php5-gd php5-pgsql php5-sqlite php5-common php-pear curl php5-json php5-redis php5-memcache
16-
RUN apt-get -y install nginx-extras
17-
RUN apt-get -y install git curl supervisor
18-
14+
# Prevent restarts when installing
1915
RUN echo '#!/bin/sh\nexit 101' > /usr/sbin/policy-rc.d && chmod +x /usr/sbin/policy-rc.d
2016

17+
# Basic packages
18+
RUN apt-get -y install php5-fpm php5-mysql php-apc php5-imagick php5-imap php5-mcrypt php5-curl php5-cli php5-gd php5-pgsql php5-sqlite php5-common php-pear curl php5-json php5-redis php5-memcache
19+
RUN apt-get -y install nginx-extras git curl supervisor
20+
2121
RUN php5enmod mcrypt
2222

2323
RUN /usr/bin/curl -sS https://getcomposer.org/installer | /usr/bin/php
@@ -29,12 +29,7 @@ RUN /usr/local/bin/composer self-update
2929
RUN /usr/local/bin/composer global require drush/drush:6.*
3030
RUN ln -s /.composer/vendor/drush/drush/drush /usr/local/bin/drush
3131

32-
# PHP
33-
RUN sed -i 's/memory_limit = .*/memory_limit = 196M/' /etc/php5/fpm/php.ini
34-
RUN sed -i 's/cgi.fix_pathinfo = .*/cgi.fix_pathinfo = 0/' /etc/php5/fpm/php.ini
35-
RUN sed -i 's/upload_max_filesize = .*/upload_max_filesize = 500M/' /etc/php5/fpm/php.ini
36-
RUN sed -i 's/post_max_size = .*/post_max_size = 500M/' /etc/php5/fpm/php.ini
37-
32+
# Prepare directory
3833
RUN mkdir /var/www
3934
RUN usermod -u 1000 www-data
4035
RUN usermod -a -G users www-data
@@ -50,19 +45,31 @@ CMD ["/usr/bin/supervisord", "-n"]
5045
ADD ./startup.sh /opt/startup.sh
5146
RUN chmod +x /opt/startup.sh
5247

53-
# Add configuration files
54-
#ADD ./config/realip.conf /etc/nginx/conf.d/realip.conf
55-
ADD ./config/supervisord-nginx.conf /etc/supervisor/conf.d/supervisord-nginx.conf
5648
RUN mkdir -p /var/cache/nginx/microcache
57-
ADD ./config/nginx.conf /etc/nginx/nginx.conf
58-
ADD ./config/mime.types /etc/nginx/mime.types
59-
ADD ./config/fastcgi.conf /etc/nginx/fastcgi.conf
60-
ADD ./config/blacklist.conf /etc/nginx/blacklist.conf
61-
ADD ./config/fastcgi_microcache_zone.conf /etc/nginx/fastcgi_microcache_zone.conf
62-
ADD ./config/drupal.conf /etc/nginx/drupal.conf
63-
ADD ./config/fastcgi_drupal.conf /etc/nginx/fastcgi_drupal.conf
64-
ADD ./config/map_cache.conf /etc/nginx/map_cache.conf
65-
ADD ./config/microcache_fcgi_auth.conf /etc/nginx/microcache_fcgi_auth.conf
66-
ADD ./config/fastcgi_no_args_drupal.conf /etc/nginx/fastcgi_no_args_drupal.conf
67-
ADD ./config/drupal_upload_progress.conf /etc/nginx/drupal_upload_progress.conf
68-
ADD ./config/default /etc/nginx/sites-enabled/default
49+
50+
### Add configuration files
51+
# Supervisor
52+
ADD ./config/supervisor/supervisord-nginx.conf /etc/supervisor/conf.d/supervisord-nginx.conf
53+
54+
# PHP
55+
ADD ./config/php/www.conf /etc/php5/fpm/pool.d/www.conf
56+
ADD ./config/php/php.ini /etc/php5/fpm/php.ini
57+
58+
# Nginx
59+
ADD ./config/nginx/blacklist.conf /etc/nginx/blacklist.conf
60+
ADD ./config/nginx/drupal.conf /etc/nginx/drupal.conf
61+
ADD ./config/nginx/drupal_upload_progress.conf /etc/nginx/drupal_upload_progress.conf
62+
ADD ./config/nginx/fastcgi.conf /etc/nginx/fastcgi.conf
63+
ADD ./config/nginx/fastcgi_drupal.conf /etc/nginx/fastcgi_drupal.conf
64+
ADD ./config/nginx/fastcgi_microcache_zone.conf /etc/nginx/fastcgi_microcache_zone.conf
65+
ADD ./config/nginx/fastcgi_no_args_drupal.conf /etc/nginx/fastcgi_no_args_drupal.conf
66+
ADD ./config/nginx/map_cache.conf /etc/nginx/map_cache.conf
67+
ADD ./config/nginx/microcache_fcgi_auth.conf /etc/nginx/microcache_fcgi_auth.conf
68+
ADD ./config/nginx/mime.types /etc/nginx/mime.types
69+
ADD ./config/nginx/nginx.conf /etc/nginx/nginx.conf
70+
ADD ./config/nginx/upstream_phpcgi_unix.conf /etc/nginx/upstream_phpcgi_unix.conf
71+
ADD ./config/nginx/map_block_http_methods.conf /etc/nginx/map_block_http_methods.conf
72+
ADD ./config/nginx/map_https_fcgi.conf /etc/nginx/map_https_fcgi.conf
73+
ADD ./config/nginx/nginx_status_allowed_hosts.conf /etc/nginx/nginx_status_allowed_hosts.conf
74+
ADD ./config/nginx/cron_allowed_hosts.conf /etc/nginx/cron_allowed_hosts.conf
75+
ADD ./config/nginx/default /etc/nginx/sites-enabled/default

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@ CURRENT_DIRECTORY := $(shell pwd)
33
build:
44
@docker build --tag=iiiepe/nginx-drupal $(CURRENT_DIRECTORY)
55

6+
build-no-cache:
7+
@docker build --no-cache --tag=iiiepe/nginx-drupal $(CURRENT_DIRECTORY)
8+
69
.PHONY: build
710

File renamed without changes.

config/nginx/cron_allowed_hosts.conf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# -*- mode: nginx; mode:autopair; mode: flyspell-prog; ispell-local-dictionary: "american" -*-
2+
### Configuration file for specifying which hosts can invoke Drupal's
3+
### cron. This only applies if you're not using drush to run cron.
4+
5+
geo $not_allowed_cron {
6+
default 1;
7+
## Add your set of hosts.
8+
127.0.0.1 0; # allow the localhost
9+
192.168.1.0/24 0; # allow on an internal network
10+
}
File renamed without changes.

config/drupal.conf renamed to config/nginx/drupal.conf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,21 +96,21 @@ location / {
9696

9797
## Run the update from the web interface with Drupal 7.
9898
location = /authorize.php {
99-
fastcgi_pass unix:/var/run/php5-fpm.sock;
99+
fastcgi_pass phpcgi;
100100
}
101101

102102
location = /update.php {
103103
#auth_basic "Restricted Access"; # auth realm
104104
#auth_basic_user_file .htpasswd-users; # htpasswd file
105-
fastcgi_pass unix:/var/run/php5-fpm.sock;
105+
fastcgi_pass phpcgi;
106106
}
107107

108108
## Restrict access to the strictly necessary PHP files. Reducing the
109109
## scope for exploits. Handling of PHP code and the Drupal event loop.
110110
location @drupal {
111111
## Include the FastCGI config.
112112
include fastcgi_drupal.conf;
113-
fastcgi_pass unix:/var/run/php5-fpm.sock;
113+
fastcgi_pass phpcgi;
114114

115115
## FCGI microcache for authenticated users also.
116116
include microcache_fcgi_auth.conf;
@@ -125,7 +125,7 @@ location @drupal-no-args {
125125
## Include the specific FastCGI configuration. This is for a
126126
## FCGI backend like php-cgi or php-fpm.
127127
include fastcgi_no_args_drupal.conf;
128-
fastcgi_pass unix:/var/run/php5-fpm.sock;
128+
fastcgi_pass phpcgi;
129129

130130
## FCGI microcache for authenticated users also.
131131
include microcache_fcgi_auth.conf;
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)