Skip to content

Commit 7b790ba

Browse files
authored
Merge pull request #6 from movabletype/feature-ssi
Enable mod_include if available
2 parents 80f77e7 + 0fe8cd3 commit 7b790ba

1 file changed

Lines changed: 22 additions & 6 deletions

File tree

mt/docker-entrypoint.sh

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,56 @@ chmod 777 /var/www/html
44
chmod 777 /var/www/cgi-bin/mt/mt-static/support
55
chmod 777 /var/www/cgi-bin/mt/themes
66

7+
conf_dirs="/etc/httpd/conf.d /etc/apache2/conf-enabled /etc/httpd/conf/extra"
8+
module_dirs="/usr/lib/apache2/modules /usr/lib64/httpd/modules /usr/lib/httpd/modules"
9+
710
if [ "$1" = "apache2-foreground" ]; then
811
rm -f /var/log/apache2/access.log # disable access logging
912

10-
httpd_conf_d=`ls -d /etc/httpd/conf.d /etc/apache2/conf-enabled /etc/httpd/conf/extra 2>/dev/null | head -1`
13+
httpd_conf_d=`ls -d $conf_dirs 2>/dev/null | head -1`
1114
cat > $httpd_conf_d/mt.conf <<CONF
1215
Timeout 3600
1316
1417
# mt-static
1518
Alias /mt-static/ /var/www/cgi-bin/mt/mt-static/
1619
CONF
1720

18-
mod_rewrite_so=`find /usr/lib/apache2/modules /usr/lib64/httpd/modules /usr/lib/httpd/modules -name 'mod_rewrite.so' 2>/dev/null | head -1`
21+
mod_rewrite_so=`find $module_dirs -name 'mod_rewrite.so' 2>/dev/null | head -1`
1922
if [ -n "$mod_rewrite_so" ]; then
2023
cat > $httpd_conf_d/mt-rewrite.conf <<CONF
2124
LoadModule rewrite_module $mod_rewrite_so
2225
CONF
2326
fi
2427

25-
mod_proxy_so=`find /usr/lib/apache2/modules /usr/lib64/httpd/modules /usr/lib/httpd/modules -name 'mod_proxy.so' 2>/dev/null | head -1`
28+
mod_proxy_so=`find $module_dirs -name 'mod_proxy.so' 2>/dev/null | head -1`
2629
if [ -n "$mod_proxy_so" ]; then
2730
cat > $httpd_conf_d/mt-proxy.conf <<CONF
2831
LoadModule proxy_module $mod_proxy_so
2932
ProxyPassReverse / http://mt/
3033
CONF
3134
fi
3235

33-
mod_proxy_http_so=`find /usr/lib/apache2/modules /usr/lib64/httpd/modules /usr/lib/httpd/modules -name 'mod_proxy_http.so' 2>/dev/null | head -1`
36+
mod_proxy_http_so=`find $module_dirs -name 'mod_proxy_http.so' 2>/dev/null | head -1`
3437
if [ -n "$mod_proxy_http_so" ]; then
3538
cat > $httpd_conf_d/mt-proxy_http.conf <<CONF
3639
LoadModule proxy_http_module $mod_proxy_http_so
3740
ProxyPassReverse / http://mt/
3841
CONF
3942
fi
4043

44+
mod_include_so=`find $module_dirs -name 'mod_include.so' 2>/dev/null | head -1`
45+
if [ -n "$mod_include_so" ]; then
46+
cat > $httpd_conf_d/mt-include.conf <<CONF
47+
LoadModule include_module /usr/lib/apache2/modules/mod_include.so
48+
<Directory /var/www/html>
49+
<IfModule mod_include.c>
50+
Options +Includes
51+
AddOutputFilter INCLUDES .html
52+
</IfModule>
53+
</Directory>
54+
CONF
55+
fi
56+
4157
if [ $httpd_conf_d = "/etc/httpd/conf/extra" ]; then
4258
# archlinux
4359
cat >> /etc/httpd/conf/httpd.conf <<CONF
@@ -57,12 +73,12 @@ CONF
5773
exec /usr/sbin/httpd -D FOREGROUND
5874
fi
5975
else
60-
httpd_conf_d=`ls -d /etc/httpd/conf.d /etc/apache2/conf-enabled /etc/httpd/conf/extra 2>/dev/null | head -1`
76+
httpd_conf_d=`ls -d $conf_dirs 2>/dev/null | head -1`
6177
cat > $httpd_conf_d/mt.conf <<CONF
6278
Timeout 3600
6379
CONF
6480

65-
mod_env_so=`find /usr/lib/apache2/modules /usr/lib64/httpd/modules /usr/lib/httpd/modules -name 'mod_env.so' 2>/dev/null | head -1`
81+
mod_env_so=`find $module_dirs -name 'mod_env.so' 2>/dev/null | head -1`
6682
if [ -n "$mod_env_so" ]; then
6783
cat > $httpd_conf_d/mt-env.conf <<CONF
6884
LoadModule env_module $mod_env_so

0 commit comments

Comments
 (0)