[new] [Windows OS]

WS2k8r2: Configure Apache 2.4.18 (64) for CGI and WSGI (windows)

Version 1: One web site (with CGI)

<apache>/conf/httpd.conf (changes only)

# LOOK FOR #!!

#ServerRoot "c:/Apache24"
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ServerRoot "s:/Apache241864"

#Listen 12.34.56.78:80
#Listen 80
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Listen 37.48.64.184:80

#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ServerAdmin info@niceware.com

#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#ServerName www.example.com:80
ServerName shareshit.nl:80

#
#DocumentRoot "c:/Apache24/htdocs"
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
DocumentRoot "W:/sites/wipyfla/root"
<Directory "W:/sites/wipyfla/root">
	# .... defaults
</Directory>

#
#ErrorLog "logs/error.log"
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ErrorLog "w:/sites/wipyfla/apachelogs/error.log"

<IfModule alias_module>
    # ScriptAlias /cgi-bin/ "c:/Apache24/cgi-bin/"
	# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	# W:\sites\ron\_RIJBLIJ_cgi-ron
	ScriptAlias /cgi/ "W:/sites/ron/_RIJBLIJ_cgi-ron/"
</IfModule>

#<Directory "c:/Apache24/cgi-bin">
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# W:\sites\ron\_RIJBLIJ_cgi-ron
<Directory "W:/sites/ron/_RIJBLIJ_cgi-ron">
    AllowOverride None
    Options None
    Require all granted
</Directory>

Version 2: Let's load the WSGI module

  • copy mod_wsi.so to `folder: <apache>/modules

/conf/httpd.conf (changes only)

  • At bottom of "Dynamic Shared Object (DSO) Support" add
 ...
#!!!!!!!!!!!!!!!!!!!!!!! mod_wsgi.so !!!!!!!!!!!!!!!!!!!!!!
# http://www.lfd.uci.edu/~gohlke/pythonlibs/#mod_wsgi  (vc10, amd64) 
# Note: extract the .whl with 7zip
LoadModule wsgi_module modules/mod_wsgi.so
#!!!!!!!!!!!!!!!!!!!!!!! mod_wsgi.so !!!!!!!!!!!!!!!!!!!!!!
...

Version 3: Flask virtual hosts

include Flask virtual host defintions

  • Include httpd-flask-vhosts.conf in: conf/httpd.conf (changes only)

conf/httpd.conf (changes only)

## Supplemental configuration
 ...
# Virtual hosts
 ...
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Include conf/extra/httpd-flask-vhosts.conf
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 ...

Contents of httpd-flask-vhosts.conf (full)

# -----------------------------------------------
# Flask (WSGI) Virtual Hosts
# httpd-flask-vhosts.conf
# -----------------------------------------------

# Required modules: mod_log_config

# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# FLask Virtual Hosts
# extra/httpd-flask-vhosts.conf
# http://flask.pocoo.org/docs/0.10/deploying/mod_wsgi/
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
# ---------------------- TEST ---------------------------
#         HW.SHARESHIT.NL
# -------------------------------------------------------
# W:\sites\wipyfla\flask\helloworld
# W:\sites\wipyfla\flask\helloworld\hwapplication.py
# W:\sites\wipyfla\flask\helloworld\hw.py
# 37.48.64.184:80
# 
<VirtualHost *:80>
# Catch all
        ServerName hw.shareshit.nl
		
		ErrorLog "w:/sites/wipyfla/apachelogs/helloworld-hw.shareshit.nl-error.log"
		CustomLog "w:/sites/wipyfla/apachelogs/helloworld-hw.shareshit.nl-XS.log" common
        WSGIScriptAlias / W:/sites/wipyfla/flask/helloworld/hwapplication.py
        <Directory W:/sites/wipyfla/flask/helloworld>
#                Order deny,allow
#                Allow from all
				Options All
				AllowOverride All
				Require all granted
        </Directory>
</VirtualHost>

# -------------------------------------------------------
#         WWW.SHARESHIT.NL
# -------------------------------------------------------

<VirtualHost *:80>

        ServerName www.shareshit.nl
		
		ErrorLog "w:/sites/wipyfla/apachelogs/www.shareshit.nl-error.log"
		CustomLog "w:/sites/wipyfla/apachelogs/www.shareshit.nl-XS.log" common
        WSGIScriptAlias / W:/sites/wipyfla/flask/www-shareshit-nl/wsgiapp.py
        <Directory W:/sites/wipyfla/flask/www-shareshit-nl>
#                Order deny,allow
#                Allow from all
				Options All
				AllowOverride All
				Require all granted
        </Directory>
</VirtualHost>

#--------------------------------------------------------
#         POLLR.GA
# -------------------------------------------------------

<VirtualHost *:80>
# http://pollr.ga
# W:\sites\dirk\_NEW_\POLLR_GA_WERK
# W:/sites/dirk/_NEW_/POLLR_GA_WERK

        ServerName pollr.ga
		
		ErrorLog "w:/sites/wipyfla/apachelogs/pollr.ga-error.log"
		CustomLog "w:/sites/wipyfla/apachelogs/pollr.ga-XS.log" common
        WSGIScriptAlias / W:/sites/dirk/_NEW_/POLLR_GA_WERK/wsgiapp.py
        <Directory W:/sites/dirk/_NEW_/POLLR_GA_WERK>
#                Order deny,allow
#                Allow from all
				Options All
				AllowOverride All
				Require all granted
        </Directory>
</VirtualHost>

# =======================================================

#<VirtualHost *:80>
#    ServerAdmin webmaster@dummy-host2.example.com
#    DocumentRoot "c:/Apache24/docs/dummy-host2.example.com"
#    ServerName dummy-host2.example.com
#    ErrorLog "logs/dummy-host2.example.com-error.log"
#    CustomLog "logs/dummy-host2.example.com-access.log" common
#</VirtualHost>
( by Tide to web developers at 2016-01-30 11:37:30 in Windows OS )



International money transfers? Worldremit beats your bank!

Domains, Hosting? Go Versio!

[Login to add a comment]
[new]