Skip to content

Commit 25f9682

Browse files
Merge branch 'release/4.2.1'
2 parents c2914ef + e717873 commit 25f9682

File tree

5 files changed

+147
-2
lines changed

5 files changed

+147
-2
lines changed

README.rst

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,103 @@ For a complete list of options you can run::
129129
Further information on using the mod_wsgi express version see the main
130130
mod_wsgi documentation.
131131

132+
Non standard Apache installations
133+
---------------------------------
134+
135+
Many Linux distributions have a tendency to screw around with the standard
136+
Apache Software Foundation layout for installation of Apache. This can
137+
include renaming the Apache ``httpd`` executable to something else, and in
138+
addition to potentially renaming it, replacing the original binary with a
139+
shell script which performs additional actions which can only be performed
140+
as the ``root`` user.
141+
142+
In the case of the ``httpd`` executable simply being renamed, the
143+
executable will obviously not be found and mod_wsgi express will fail to
144+
start at all.
145+
146+
In this case you should work out what the ``httpd`` executable was renamed
147+
to and use the ``--httpd-executable`` option to specify its real location.
148+
149+
For example, if ``httpd`` was renamed to ``apache2``, you might need to use::
150+
151+
mod_wsgi-express start-server wsgi.py --httpd-executable=/usr/sbin/apache2
152+
153+
In the case of the ``httpd`` executable being replaced with a shell script
154+
which performs additional actions before then executing the original
155+
``httpd`` executable, and the shell script is failing in some way, you will
156+
need to use the location of the original ``httpd`` executable the shell
157+
script is in turn executing.
158+
159+
Running mod_wsgi express as root
160+
--------------------------------
161+
162+
The primary intention of mod_wsgi express is to make it easier for users
163+
to run up Apache on non privileged ports, especially during the development
164+
of a Python web application. If you want to be able to run Apache using
165+
mod_wsgi express on a privileged port such as the standard port 80 used by
166+
HTTP servers, then you will need to run ``mod_wsgi-express`` as root. In
167+
doing this, you will need to perform additional steps.
168+
169+
The first thing you must do is supply the ``--user`` and ``--group``
170+
options to say what user and group your Python web application should run
171+
as. Most Linux distrbutions will pre define a special user for Apache to
172+
run as, so you can use that. Alternatively you can use any other special
173+
user account you have created for running the Python web application::
174+
175+
mod_wsgi-express start-server wsgi.py --port=80 \
176+
--user www-data --group www-data
177+
178+
This approach to running ``mod_wsgi-express`` will be fine so long as you
179+
are using a process supervisor which expects the started process to remain
180+
in the foreground and not daemonize.
181+
182+
If however you are directly integrating into the system init scripts where
183+
separate start and stop commands are expected, with the executing process
184+
expected to be daemonized, then a different process is required to setup
185+
mod_wsgi express.
186+
187+
In this case, instead of simply using the ``start-server`` command to
188+
``mod_wsgi-express`` you should use ``setup-server``::
189+
190+
mod_wsgi-express start-server wsgi.py --port=80 \
191+
--user www-data --group www-data \
192+
--server-root=/etc/mod_wsgi-express-80
193+
194+
In running this command, it will not actually startup Apache. All it will do
195+
is create the set of configuration files and startup script to be run.
196+
197+
So that these are not created in the default location of a directory under
198+
``/tmp``, you should use the ``--server-root`` option to specify where they
199+
should be placed.
200+
201+
Having created the configuration and startup script, to start the Apache
202+
instance you can now run::
203+
204+
/etc/mod_wsgi-express-80/apachectl start
205+
206+
To subsequently stop the Apache instance you can run::
207+
208+
/etc/mod_wsgi-express-80/apachectl stop
209+
210+
You can also restart the Apache instance as necessary using::
211+
212+
/etc/mod_wsgi-express-80/apachectl restart
213+
214+
Using this approach, the original options you supplied to ``setup-server``
215+
will effectively be cached with the resulting configuration used each time.
216+
If you need to update the set of options, run ``setup-server`` again with
217+
the new set of options.
218+
219+
Note that even taking all these steps, it is possible that running up
220+
Apache as ``root`` using mod_wsgi express may fail on systems where SELinux
221+
extensions are enabled. This is because the SELinux profile may not match
222+
what is being expected for the way that Apache is being started, or
223+
alternatively, the locations that Apache has been specified as being
224+
allowed to access, don't match where the directory specified using the
225+
``--server-root`` directory was placed. You may therefore need to configure
226+
SELinux or move the directory used with ``--server-root`` to an allowed
227+
location.
228+
132229
Using mod_wsgi express with Django
133230
----------------------------------
134231

docs/release-notes/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Release Notes
55
.. toctree::
66
:maxdepth: 2
77

8+
version-4.2.1.rst
89
version-4.2.0.rst
910

1011
version-4.1.3.rst

docs/release-notes/version-4.2.1.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
=============
2+
Version 4.2.1
3+
=============
4+
5+
Version 4.2.1 of mod_wsgi can be obtained from:
6+
7+
https://github.com/GrahamDumpleton/mod_wsgi/archive/4.2.1.tar.gz
8+
9+
Known Issues
10+
------------
11+
12+
1. The makefiles for building mod_wsgi on Windows are currently broken and
13+
need updating. As most new changes relate to mod_wsgi daemon mode, which is
14+
not supported under Windows, you should keep using the last available
15+
binary for version 3.X on Windows instead.
16+
17+
Bugs Fixed
18+
----------
19+
20+
1. The auto generated configuration would not work with an Apache
21+
installation where core Apache modules were statically compiled into Apache
22+
rather than being dynamically loaded.

src/server/__init__.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ def find_mimetypes():
6868
return name
6969

7070
APACHE_GENERAL_CONFIG = """
71+
<IfModule !version_module>
7172
LoadModule version_module '%(modules_directory)s/mod_version.so'
73+
</IfModule>
7274
7375
ServerName %(host)s
7476
ServerRoot '%(server_root)s'
@@ -113,21 +115,42 @@ def find_mimetypes():
113115
</IfVersion>
114116
115117
<IfVersion >= 2.4>
118+
<IfModule !access_compat_module>
116119
LoadModule access_compat_module '%(modules_directory)s/mod_access_compat.so'
120+
</IfModule>
121+
<IfModule !unixd_module>
117122
LoadModule unixd_module '%(modules_directory)s/mod_unixd.so'
123+
</IfModule>
124+
<IfModule !authn_core_module>
118125
LoadModule authn_core_module '%(modules_directory)s/mod_authn_core.so'
126+
</IfModule>
127+
<IfModule !authz_core_module>
119128
LoadModule authz_core_module '%(modules_directory)s/mod_authz_core.so'
129+
</IfModule>
120130
</IfVersion>
121131
132+
<IfModule !authz_host_module>
122133
LoadModule authz_host_module '%(modules_directory)s/mod_authz_host.so'
134+
</IfModule>
135+
<IfModule !mime_module>
123136
LoadModule mime_module '%(modules_directory)s/mod_mime.so'
137+
</IfModule>
138+
<IfModule !rewrite_module>
124139
LoadModule rewrite_module '%(modules_directory)s/mod_rewrite.so'
140+
</IfModule>
141+
<IfModule !alias_module>
125142
LoadModule alias_module '%(modules_directory)s/mod_alias.so'
143+
</IfModule>
144+
<IfModule !dir_module>
126145
LoadModule dir_module '%(modules_directory)s/mod_dir.so'
146+
</IfModule>
147+
127148
LoadModule wsgi_module '%(mod_wsgi_so)s'
128149
129150
<IfDefine WSGI_SERVER_METRICS>
151+
<IfModule !status_module>
130152
LoadModule status_module '%(modules_directory)s/mod_status.so'
153+
</IfModule>
131154
</IfDefine>
132155
133156
<IfVersion < 2.4>
@@ -227,7 +250,9 @@ def find_mimetypes():
227250
LogLevel %(log_level)s
228251
229252
<IfDefine WSGI_ACCESS_LOG>
253+
<IfModule !log_config_module>
230254
LoadModule log_config_module %(modules_directory)s/mod_log_config.so
255+
</IfModule>
231256
LogFormat "%%h %%l %%u %%t \\"%%r\\" %%>s %%b" common
232257
CustomLog "%(log_directory)s/access_log" common
233258
</IfDefine>

src/server/wsgi_version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525

2626
#define MOD_WSGI_MAJORVERSION_NUMBER 4
2727
#define MOD_WSGI_MINORVERSION_NUMBER 2
28-
#define MOD_WSGI_MICROVERSION_NUMBER 0
29-
#define MOD_WSGI_VERSION_STRING "4.2.0"
28+
#define MOD_WSGI_MICROVERSION_NUMBER 1
29+
#define MOD_WSGI_VERSION_STRING "4.2.1"
3030

3131
/* ------------------------------------------------------------------------- */
3232

0 commit comments

Comments
 (0)