|
...
|
...
|
@@ -90,49 +90,15 @@ function install_apache_wsgi {
|
|
90
|
90
|
fi
|
|
91
|
91
|
# WSGI isn't enabled by default, enable it
|
|
92
|
92
|
enable_apache_mod wsgi
|
|
93
|
|
-
|
|
94
|
|
- # ensure mod_version enabled for <IfVersion ...>. This is
|
|
95
|
|
- # built-in statically on anything recent, but precise (2.2)
|
|
96
|
|
- # doesn't have it enabled
|
|
97
|
|
- sudo a2enmod version || true
|
|
98
|
|
-}
|
|
99
|
|
-
|
|
100
|
|
-# get_apache_version() - return the version of Apache installed
|
|
101
|
|
-# This function is used to determine the Apache version installed. There are
|
|
102
|
|
-# various differences between Apache 2.2 and 2.4 that warrant special handling.
|
|
103
|
|
-function get_apache_version {
|
|
104
|
|
- if is_ubuntu; then
|
|
105
|
|
- local version_str
|
|
106
|
|
- version_str=$(sudo /usr/sbin/apache2ctl -v | awk '/Server version/ {print $3}' | cut -f2 -d/)
|
|
107
|
|
- elif is_fedora; then
|
|
108
|
|
- local version_str
|
|
109
|
|
- version_str=$(rpm -qa --queryformat '%{VERSION}' httpd)
|
|
110
|
|
- elif is_suse; then
|
|
111
|
|
- local version_str
|
|
112
|
|
- version_str=$(rpm -qa --queryformat '%{VERSION}' apache2)
|
|
113
|
|
- else
|
|
114
|
|
- exit_distro_not_supported "cannot determine apache version"
|
|
115
|
|
- fi
|
|
116
|
|
- if [[ "$version_str" =~ ^2\.2\. ]]; then
|
|
117
|
|
- echo "2.2"
|
|
118
|
|
- elif [[ "$version_str" =~ ^2\.4\. ]]; then
|
|
119
|
|
- echo "2.4"
|
|
120
|
|
- else
|
|
121
|
|
- exit_distro_not_supported "apache version not supported"
|
|
122
|
|
- fi
|
|
123
|
93
|
}
|
|
124
|
94
|
|
|
125
|
95
|
# apache_site_config_for() - The filename of the site's configuration file.
|
|
126
|
96
|
# This function uses the global variables APACHE_NAME and APACHE_CONF_DIR.
|
|
127
|
97
|
#
|
|
128
|
|
-# On Ubuntu 14.04, the site configuration file must have a .conf suffix for a2ensite and a2dissite to
|
|
|
98
|
+# On Ubuntu 14.04+, the site configuration file must have a .conf suffix for a2ensite and a2dissite to
|
|
129
|
99
|
# recognise it. a2ensite and a2dissite ignore the .conf suffix used as parameter. The default sites'
|
|
130
|
100
|
# files are 000-default.conf and default-ssl.conf.
|
|
131
|
101
|
#
|
|
132
|
|
-# On Ubuntu 12.04, the site configuration file may have any format, as long as it is in
|
|
133
|
|
-# /etc/apache2/sites-available/. a2ensite and a2dissite need the entire file name to work. The default
|
|
134
|
|
-# sites' files are default and default-ssl.
|
|
135
|
|
-#
|
|
136
|
102
|
# On Fedora and openSUSE, any file in /etc/httpd/conf.d/ whose name ends with .conf is enabled.
|
|
137
|
103
|
#
|
|
138
|
104
|
# On RHEL and CentOS, things should hopefully work as in Fedora.
|
|
...
|
...
|
@@ -141,22 +107,14 @@ function get_apache_version {
|
|
141
|
141
|
# +----------------------+--------------------+--------------------------+--------------------------+
|
|
142
|
142
|
# | Distribution | File name | Site enabling command | Site disabling command |
|
|
143
|
143
|
# +----------------------+--------------------+--------------------------+--------------------------+
|
|
144
|
|
-# | Ubuntu 12.04 | site | a2ensite site | a2dissite site |
|
|
145
|
144
|
# | Ubuntu 14.04 | site.conf | a2ensite site | a2dissite site |
|
|
146
|
145
|
# | Fedora, RHEL, CentOS | site.conf.disabled | mv site.conf{.disabled,} | mv site.conf{,.disabled} |
|
|
147
|
146
|
# +----------------------+--------------------+--------------------------+--------------------------+
|
|
148
|
147
|
function apache_site_config_for {
|
|
149
|
148
|
local site=$@
|
|
150
|
149
|
if is_ubuntu; then
|
|
151
|
|
- local apache_version
|
|
152
|
|
- apache_version=$(get_apache_version)
|
|
153
|
|
- if [[ "$apache_version" == "2.2" ]]; then
|
|
154
|
|
- # Ubuntu 12.04 - Apache 2.2
|
|
155
|
|
- echo $APACHE_CONF_DIR/${site}
|
|
156
|
|
- else
|
|
157
|
|
- # Ubuntu 14.04 - Apache 2.4
|
|
158
|
|
- echo $APACHE_CONF_DIR/${site}.conf
|
|
159
|
|
- fi
|
|
|
150
|
+ # Ubuntu 14.04 - Apache 2.4
|
|
|
151
|
+ echo $APACHE_CONF_DIR/${site}.conf
|
|
160
|
152
|
elif is_fedora || is_suse; then
|
|
161
|
153
|
# fedora conf.d is only imported if it ends with .conf so this is approx the same
|
|
162
|
154
|
local enabled_site_file="$APACHE_CONF_DIR/${site}.conf"
|