I have used mod_wsgi-express to produce an Apache config, but I would like 
to convert my httpd.conf file to run Apache using the "vanilla" mod_wsgi 
module.

My intention from the outset was to use "express" only to get the actual 
config running, but currently it returns "500 Internal Server" for both 
"http" and "httpd" URLS, with no error indication that I can see in _any_ 
of the Apache logs or in the Django app log! I have been struggling with 
this Apache + Django setup for nearly a week now, despite mod_wsgi-express 
maybe making it easier.

I can see from the httpd output that all the TLS certificate validation 
works fine. So that is one less thing to worry about. 

As I explained in my previous post, this is all running in a Docker 
container, and I have managed to install all the relevant Django modules 
and other modules need by the app in the system-wide python3, by adding the 
option "--prefix=/usr" to every "pip3 install" and "python3 setup.py 
install" command in my Dockefile So I can run the httpd server as user 
"apache" without having to worry about pipenv etc. ( I have no desire 
whatever to run python in a virtual environment, as I have not used these 
before and this would add to the many complications besetting me!! In 
general virtual python environments should not be needed in Docker 
containers! )

I am aware the present httpd.conf (copied below) is somewhat lax in 
security. But for now I am _only_ interested in getting the blasted thing 
to a state where Apache at least works, and only then I will worry about 
nailing down the security, such as further limiting the "Allow all" scope.

When Apache is running, I don't see a separate process with port 8443 in 
its name. So I'm not convinced anything is listening on port 8443.


<IfModule !version_module>
LoadModule version_module '${MOD_WSGI_MODULES_DIRECTORY}/mod_version.so'
</IfModule>

Include /application/apache/ssl.conf

ServerName jrsurveys.com
ServerRoot '/application/apache'
PidFile '/application/apache/httpd.pid'

DefaultRuntimeDir '/application/apache'

WSGIScriptAlias / /application/source/bos2.wsgi

ServerTokens ProductOnly
ServerSignature Off

User ${MOD_WSGI_USER}
Group ${MOD_WSGI_GROUP}

Listen 8000
Listen 8443

<IfModule !mpm_event_module>
<IfModule !mpm_worker_module>
<IfModule !mpm_prefork_module>
LoadModule mpm_event_module '${MOD_WSGI_MODULES_DIRECTORY}/mod_mpm_event.so'
</IfModule>
</IfModule>
</IfModule>

<IfModule !access_compat_module>
LoadModule access_compat_module 
'${MOD_WSGI_MODULES_DIRECTORY}/mod_access_compat.so'
</IfModule>

<IfModule !unixd_module>
LoadModule unixd_module '${MOD_WSGI_MODULES_DIRECTORY}/mod_unixd.so'
</IfModule>

<IfModule !authn_core_module>
LoadModule authn_core_module 
'${MOD_WSGI_MODULES_DIRECTORY}/mod_authn_core.so'
</IfModule>

<IfModule !authz_core_module>
LoadModule authz_core_module 
'${MOD_WSGI_MODULES_DIRECTORY}/mod_authz_core.so'
</IfModule>

<IfModule !authz_host_module>
LoadModule authz_host_module 
'${MOD_WSGI_MODULES_DIRECTORY}/mod_authz_host.so'
</IfModule>

<IfModule !mime_module>
LoadModule mime_module '${MOD_WSGI_MODULES_DIRECTORY}/mod_mime.so'
</IfModule>

<IfModule !rewrite_module>
LoadModule rewrite_module '${MOD_WSGI_MODULES_DIRECTORY}/mod_rewrite.so'
</IfModule>

<IfModule !alias_module>
LoadModule alias_module '${MOD_WSGI_MODULES_DIRECTORY}/mod_alias.so'
</IfModule>

<IfModule !dir_module>
LoadModule dir_module '${MOD_WSGI_MODULES_DIRECTORY}/mod_dir.so'
</IfModule>

<IfModule !env_module>
LoadModule env_module '${MOD_WSGI_MODULES_DIRECTORY}/mod_env.so'
</IfModule>

<IfModule !headers_module>
LoadModule headers_module '${MOD_WSGI_MODULES_DIRECTORY}/mod_headers.so'
</IfModule>

<IfModule !filter_module>
LoadModule filter_module '${MOD_WSGI_MODULES_DIRECTORY}/mod_filter.so'
</IfModule>

<IfModule !reqtimeout_module>
LoadModule reqtimeout_module 
'${MOD_WSGI_MODULES_DIRECTORY}/mod_reqtimeout.so'
</IfModule>

<IfModule mpm_prefork_module>
</IfModule>

LoadModule wsgi_module 
'/usr/lib64/python3.6/site-packages/mod_wsgi/server/mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so'

TypesConfig '/etc/mime.types'

HostnameLookups Off
MaxMemFree 64
Timeout 60
ListenBacklog 500

RequestReadTimeout header=15-30,MinRate=500 body=15,MinRate=500

LimitRequestBody 10485760

<Directory />
     AllowOverride None
     Require all granted
     Options FollowSymLinks
</Directory>

WSGIPythonHome '/usr'

WSGIVerboseDebugging 'Off'

WSGISocketPrefix /application/apache/wsgi

WSGISocketRotation Off

WSGIRestrictEmbedded On

WSGIDaemonProcess localhost:8000 \
   display-name='(wsgi:localhost:8000:0)' \
   home='/application/apache' \
   threads=5 \
   maximum-requests=0 \
   python-path='' \
   python-eggs='/application/apache/python-eggs' \
   lang='en_US.UTF-8' \
   locale='en_US.UTF-8' \
   listen-backlog=100 \
   queue-timeout=45 \
   socket-timeout=60 \
   connect-timeout=15 \
   request-timeout=60 \
   inactivity-timeout=0 \
   startup-timeout=15 \
   deadlock-timeout=60 \
   graceful-timeout=15 \
   eviction-timeout=0 \
   restart-interval=0 \
   cpu-time-limit=0 \
   shutdown-timeout=5 \
   send-buffer-size=0 \
   receive-buffer-size=0 \
   response-buffer-size=0 \
   response-socket-timeout=0 \
   server-metrics=Off

WSGICallableObject 'application'
WSGIPassAuthorization On
WSGIMapHEADToGET Auto

WSGIServerMetrics Off

KeepAlive Off

ErrorLog "/application/apache/error.log"
LogLevel warn

<IfModule !log_config_module>
LoadModule log_config_module ${MOD_WSGI_MODULES_DIRECTORY}/mod_log_config.so
</IfModule>
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" 
combined
LogFormat "undefined" custom
CustomLog "/application/apache/access.log" common

<IfModule !ssl_module>
LoadModule ssl_module ${MOD_WSGI_MODULES_DIRECTORY}/mod_ssl.so
</IfModule>

<IfModule mpm_prefork_module>
ServerLimit 20
StartServers 1
MaxClients 20
MinSpareServers 1
MaxSpareServers 2
MaxRequestsPerChild 0
</IfModule>

<IfModule mpm_worker_module>
ServerLimit 2
ThreadLimit 10
StartServers 1
MaxClients 20
MinSpareThreads 10
MaxSpareThreads 10
ThreadsPerChild 10
MaxRequestsPerChild 0
ThreadStackSize 262144
</IfModule>

<IfModule mpm_event_module>
ServerLimit 2
ThreadLimit 10
StartServers 1
MaxClients 20
MinSpareThreads 10
MaxSpareThreads 10
ThreadsPerChild 10
MaxRequestsPerChild 0
ThreadStackSize 262144
</IfModule>

# See https://httpd.apache.org/docs/2.4/vhosts/name-based.html

<VirtualHost *:8000>
ServerName  jrsurveys.com
ServerAlias jrsurveys.com *.jrsurveys.com
<Directory />
    Require all granted
</Directory>
LogLevel trace4
ErrorLog  /application/apache/error_https.log
CustomLog /application/apache/access_https.log combined
</VirtualHost>

<VirtualHost *:8443>
ServerName  jrsurveys.com
ServerAlias jrsurveys.com *.jrsurveys.com
<Directory />
    Require all granted
</Directory>
LogLevel trace4
ErrorLog  /application/apache/error_https.log
CustomLog /application/apache/access_https.log combined
SSLEngine On
SSLCertificateFile /etc/pki/tls/certs/jrsurveys.com.crt
SSLCertificateKeyFile /etc/pki/tls/private/jrsurveys.com.key
</VirtualHost>

DocumentRoot '/application/apache'

AccessFileName .htaccess

<Directory '/application/apache'>
    AllowOverride None
    RewriteEngine On
    Include /application/apache/rewrite.conf
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule .* - [H=wsgi-handler]
    Require all granted
</Directory>

WSGIHandlerScript wsgi-handler '/application/apache/handler.wsgi' \
    process-group='localhost:8000' application-group=%{GLOBAL}
WSGIImportScript '/application/apache/handler.wsgi' \
    process-group='localhost:8000' application-group=%{GLOBAL}



Regards

John R



-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/modwsgi/3f36b53b-c370-4bfa-83c2-fef94f9b541a%40googlegroups.com.

Reply via email to