- Quick start for Windows, either 32-bit or 64-bit
- To install Apache Server
- To install Python and run through Apache Server
- To run a Flask application using Apache module "mod_wsgi"
- Full installation for Windows, either 32-bit or 64-bit
- To install Apache Server
- To install Python and run through Apache Server
- To run a Flask application using Apache module "mod_wsgi"
- Full installation for Ubuntu Linux via SSH terminal
- To install Apache Server
- To install Python and run through Apache Server
- To run a Flask application using Apache module "mod_wsgi"
Note this will install a 32-bit version of Apache, if you'd like a 64-bit version, please see the next section below. Also note, if you have issues making the below instructions work, you may want to try the Full Installation method below.
Also note, this has only been tested on Windows Server 2012, but should work on Windows 10 and other Windows versions.
- Unzip Git file
/Windows/Apache24.zip
to yourC:\
directory - Open command prompt, run the following:
"C:\Apache24\bin\httpd.exe" -k start
- Open browser, go to http://localhost:82
- You should see a page saying "Hello from Apache Server!"
- Extras
- To debug, look at logs in your
C:\Apache24\logs
directory - To restart the Apache server after you've made a change, run the following command:
"C:\Apache24\bin\httpd.exe" -k restart
- To stop the Apache server, run the following command:
"C:\Apache24\bin\httpd.exe" -k stop
- To install Apache, meaning it will be added as an automatically starting Windows service, run the following command in an Admin command prompt:
"C:\Apache24\bin\httpd.exe" -k install
- To debug, look at logs in your
- Install a 32-bit version of Python, I used version 3.7, but other versions should work as well. Make sure to map to PATH variables in installation
- Edit the top line of file
C:\Apache24\htdocs\testcgi.py
to your Python installation directory, for example for me it was:#!C:\Program Files (x86)\Python37-32\python.exe
- Restart Apache, then go to http://localhost:80/testcgi.py and you should see a page saying "Hello from Python!"
- Open
C:\Apache24\conf\httpd.conf
in a text editor. Add the following code underneath the line with textListen localhost:82
<VirtualHost localhost:82> ServerAdmin domains@domain1.com WSGIScriptAlias / "C:/Apache24/htdocs_wsgi/web.wsgi" WSGIApplicationGroup %{GLOBAL} DocumentRoot C:/Apache24/htdocs_wsgi <Directory "C:/Apache24/htdocs_wsgi/"> Options +Indexes +Includes +FollowSymLinks +MultiViews +ExecCGI Require all granted </Directory> CustomLog C:/Apache24/logs/access.log common ErrorLog C:/Apache24/logs/error.log </VirtualHost>
- Install these Python packages that are being used by this test website, by running command prompt commands:
pip install flask
pip install numpy
pip install pandas
pip install plotly
- Restart Apache, then go to http://localhost:82/ and you should see a page saying "Welcome to the Flask application!" which will look like this:
- And you'll be able to test various features on this page:
Note, this has only been tested on Windows Server 2012, but should work on Windows 10 and other Windows versions.
- Download Apache server from Git directory
/Windows/full_installation/httpd-2.4.35-win32-VC15.zip
or from https://httpd.apache.org/docs/2.4/platform/windows.html - Unzip contents into
C:\Apache24
directory such that thehtdocs
directory is located here:C:\Apache24\htdocs
- Open command prompt, run the following:
"C:\Apache24\bin\httpd.exe" -k start
- Open browser, go to http://localhost:80
- You should see a page saying "It works!"
- Extras
- To debug, look at logs in your
C:\Apache24\logs
directory - A common issue here is that port 80 is already being used. Running
netstat -an
in the command prompt will tell you what ports are in use. You may want to try changing theListen 80
port in fileC:\Apache24\conf\httpd.conf
to something else - To restart the Apache server after you've made a change, run the following command:
"C:\Apache24\bin\httpd.exe" -k restart
- To stop the Apache server, run the following command:
"C:\Apache24\bin\httpd.exe" -k stop
- To install Apache, meaning it will be added as an automatically starting Windows service, run the following command in an Admin command prompt:
"C:\Apache24\bin\httpd.exe" -k install
- To debug, look at logs in your
- Install a 32-bit version of Python, I used version 3.7, but other versions should work as well. Make sure to map to PATH variables in the installation
- Copy Git file
/Windows/full_installation/testcgi.py
toC:\Apache24\htdocs\
. Edit the top line of file to your Python installation directory, for example for me it was:#!C:\Program Files (x86)\Python37-32\python.exe
- Edit file
C:\Apache24\conf\httpd.conf
- Find this line:
Options Indexes FollowSymLinks
and replace it with this:Options Indexes FollowSymLinks ExecCGI
- Find this line:
#AddHandler cgi-script .cgi
and replace it with this:AddHandler cgi-script .cgi .py
- Find this line:
- Restart Apache, then go to http://localhost:82/testcgi.py and you should see a page saying "Hello from Python!"
- Copy Git files
/Windows/full_installation/htdocs_wsgi/app.py
and/Windows/full_installation/htdocs_wsgi/web.wsgi
to your directoryC:\Apache24\htdocs_wsgi\
- Open an Administrator command prompt, and navigate to folder
C:\Apache24\modules
- Run command
pip install mod_wsgi
then run commandmod_wsgi-express module-config
which will create a module file in this directory. For me this was namedmod_wsgi.pyd
and its contents will depend on your Windows/Python versions. Also in theC:\Apache24\conf\httpd.conf
file, Add the following code underneath the line with textLoadModule ...
(in theLoadModule
section)LoadModule wsgi_module modules/mod_wsgi.pyd
- Also in the
C:\Apache24\conf\httpd.conf
file, add the following code underneath the line with textListen 80
<VirtualHost localhost:80> ServerAdmin domains@domain1.com WSGIScriptAlias / "C:/Apache24/htdocs_wsgi/web.wsgi" WSGIApplicationGroup %{GLOBAL} DocumentRoot C:/Apache24/htdocs_wsgi <Directory "C:/Apache24/htdocs_wsgi/"> Options +Indexes +Includes +FollowSymLinks +MultiViews +ExecCGI Require all granted </Directory> CustomLog C:/Apache24/logs/access.log common ErrorLog C:/Apache24/logs/error.log </VirtualHost>
- Install this Python package that is being used by this test website, by running command:
pip install flask
- Restart Apache, then go to http://localhost:80/ and you should see a page saying "Hello from Flask!" that will look like this:
- If you'd like to test a fully formatted example website, do the following:
- Delete contents of
C:\Apache24\htdocs_wsgi
and copy in contents of Git directory/Windows/Apache24/htdocs_wsgi
- Install these Python packages, by running command prompt commands:
pip install numpy
pip install pandas
pip install plotly
- Delete contents of
- Restart Apache, then go to http://localhost:80/ and you should see a sample webpage that looks like this:
- And you'll be able to test various features on this page:
Coming soon!