File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,24 +4,30 @@ services:
44 # The web server container.
55 # #
66 wordpress-develop :
7- image : nginx:alpine
8-
7+ image : httpd:alpine
98 networks :
109 - wpdevnet
11-
1210 ports :
1311 - ${LOCAL_PORT-8889}:80
14-
1512 environment :
1613 LOCAL_DIR : ${LOCAL_DIR-src}
17-
1814 volumes :
19- - ./tools/local-env/default.template:/etc/nginx/ conf.d/default.template
15+ - ./tools/local-env/apache-vhost.conf:/usr/local/apache2/ conf/extra/httpd-vhosts.conf
2016 - ./:/var/www
21-
22- # Load our config file, substituting environment variables into the config.
23- command : /bin/sh -c "envsubst '$$LOCAL_DIR' < /etc/nginx/conf.d/default.template > /etc/nginx/conf.d/default.conf && exec nginx -g 'daemon off;'"
24-
17+ command : >
18+ /bin/sh -c "
19+ sed -e '/Include conf\\/extra\\/httpd-vhosts.conf/s/^#//' /usr/local/apache2/conf/httpd.conf > /tmp/httpd.conf &&
20+ cat /tmp/httpd.conf > /usr/local/apache2/conf/httpd.conf &&
21+ rm /tmp/httpd.conf &&
22+ echo 'LoadModule rewrite_module modules/mod_rewrite.so' >> /usr/local/apache2/conf/httpd.conf &&
23+ echo 'LoadModule proxy_module modules/mod_proxy.so' >> /usr/local/apache2/conf/httpd.conf &&
24+ echo 'LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so' >> /usr/local/apache2/conf/httpd.conf &&
25+ echo 'LoadModule proxy_http_module modules/mod_proxy_http.so' >> /usr/local/apache2/conf/httpd.conf &&
26+ sed -e 's/\$$LOCAL_DIR/$${LOCAL_DIR}/g' /usr/local/apache2/conf/extra/httpd-vhosts.conf > /tmp/httpd-vhosts.conf &&
27+ cat /tmp/httpd-vhosts.conf > /usr/local/apache2/conf/extra/httpd-vhosts.conf &&
28+ rm /tmp/httpd-vhosts.conf &&
29+ exec httpd-foreground
30+ "
2531 depends_on :
2632 php :
2733 condition : service_started
Original file line number Diff line number Diff line change 1+ <VirtualHost *:80>
2+ ServerName localhost
3+ # See https://core.trac.wordpress.org/ticket/63316#comment:5
4+ HttpProtocolOptions Unsafe
5+ DocumentRoot "/var/www/${LOCAL_DIR}"
6+ DirectoryIndex index.php index.html
7+
8+ <Directory "/var/www/${LOCAL_DIR}">
9+ Options Indexes FollowSymLinks
10+ AllowOverride All
11+ Require all granted
12+ </Directory>
13+
14+ <FilesMatch \.php$>
15+ SetHandler "proxy:fcgi://php:9000"
16+ </FilesMatch>
17+
18+ # WordPress rewrite rules
19+ RewriteEngine On
20+ RewriteCond %{REQUEST_FILENAME} !-f
21+ RewriteCond %{REQUEST_FILENAME} !-d
22+ RewriteRule ^/wp-admin$ /wp-admin/ [R=301,L]
23+ RewriteRule ^(/[^/]+)?(/wp-.*) $2 [L]
24+ RewriteRule ^(/[^/]+)?(/.*\.php) $2 [L]
25+ RewriteRule . index.php [L]
26+
27+ # Reverse Proxy configuration for PHP-FPM
28+ ProxyPreserveHost On
29+ ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://php:9000/var/www/${LOCAL_DIR}/$1
30+ ProxyTimeout 300
31+
32+ ErrorLog /proc/self/fd/2
33+ CustomLog /proc/self/fd/1 combined
34+ LogLevel debug
35+
36+ <IfModule mod_headers.c>
37+ Header always set X-Frame-Options "SAMEORIGIN"
38+ Header always set X-Content-Type-Options "nosniff"
39+ </IfModule>
40+ </VirtualHost>
You can’t perform that action at this time.
0 commit comments