Detalles del post: How to install complete Apache2 + SSL + web2py with wsgi in Windows

20.07.09

Permalink 01:49:12, by admin Email , 430 words, 14350 views views  
Categories: Varios (Miscelea), Tutoriales

How to install complete Apache2 + SSL + web2py with wsgi in Windows

In this little guide you will see how to install complete Apache2 + SSL + web2py using mod_wsgi in Windows

Lets go to install and setup an Apache2 Server with SSL connection and web2py framework in Windows Enviroment

Download and install WampServer

You can download from http://www.wampserver.com. WampServer contains Apache2 Web Server + MySQL database + PHP script languaje (I installed in e:\wamp)

Download and install web2py (source code)

Download from http://web2py.com. To install web2py, just decompress the zip into d:\ (thus having d:\web2py)

Activate ssl_module in Apache2

SSL module comes by default installed in WampServer

Install mod_wsgi

Copy mod_wsi to Apache modules directory

Load mod_wsgi

Load module, adding LoadModule wsgi_module /mod_wsgi.so line to httpd.conf

Go to apache bin directory

There must to be an openssl.exe file

Generate des3 key file

openssl genrsa -des3 -out myserver.key 1024

Remove rsa from key file, if not Apache2 server will complain in Windows (the good key file will be myserver.pem)

openssl rsa -in myserver.key -out myserver.pem

Now that we've created the private key, we need to generate the CSR like so

openssl req -new -key myserver.key -out myserver.csr

If you get errors about a missing conf file you can add the following option: -config d:\wamp\bin\apache\apacheX.X.X\conf\openssl.cnf
Make sure "Common Name (eg, YOUR name)" is your host name for the VirtualHost eg . mylocalhost

Generating a Self-Signed Certificate

openssl x509 -req -days 365 -in myserver.csr -signkey myserver.key -out myserver.crt
You can limit active days with -days option

Move files to conf\ssl directory

Create ssl directory inside Apache conf directory and move all myserver* files to there

Configure Apache to use SSL

Edit the http.conf file via WAMPs menu or directly here: C:\wamp\bin\apache\apache2.2.6\conf\httpd.cnf Locate the line Listen 80 and put to listen 443 port too
Listen 80
Listen 443

Now create a new virtual host like so (in addition to any normal port 80 entries)

1.- Typical sentences with document root and servername (use your certificate servername)
2.- Activate wsgi interpreter creating an Alias (all files from / and inside, will be handle with wsgihandler)
3.- Activate SSLEngine and put your certificate and key files path (the key file is the .pem file without rsa)

Add another virtualhost with port 80 if you want


Finally Restart Wamp and pray


Trackback address for this post:

http://www.mhproject.org/htsrv/trackback.php/153

Comments, Trackbacks, Pingbacks:

Comment from: Graham Dumpleton [Visitor] Email · http://blog.dscpl.com.au
You should avoid using the mod_wsgi Windows binaries you have, they are old and have a number of notable bugs which may cause problems. Up to date binaries are available from the mod_wsgi site.

Also, the Location/LocationMatch directives you are using to allow Apache to serve files are a bad idea and doing it that way makes your web server less secure. In this respect, the instructions found with some web2py documentation which you may be following is quite poor and doesn't use best practice. You should use Directory directives instead and qualify access by where the files are stored in the file system and not by the URL path that access them.

By using Location/LocationMatch directive in the way you have, you have effectively said that someone can download any file from your computer accessible via any URL. The only saving grace at present is that there probably isn't a URL which maps to high in the file system, but if through misconfiguration that was done, then there is nothing else to protect your files from being downloaded. The Directory directive when used properly, would prevent any files outside of the intended directories being downloadable.

If you don't really care about good security, then by all means use what you are, but be warned.
PermalinkPermalink 2009-07-20 @ 03:33
Comment from: admin [Member] Email
Thanks a lot Graham, the problem with mod_wsgi is that I dind't found updated module for Py2.5 in this location: http://code.google.com/p/modwsgi/downloads/list
All of them are Py2.6 compatible, could you provide me with any link to Py.25 Windows binary module compatible? Maybe Py2.6 module is backward compatible with Py2.5, does it?

With respect to Location directives, I actually followed the web2py documentation, could you give me and example with only using Directory directives?
In deed, as you notice, I move the web2py directory out of public www Apache path to avoid security problems (but as you say, it's maybe not sufficient enough)
PermalinkPermalink 2009-07-20 @ 15:47
Comment from: Cheap Computers [Visitor] Email · http://www.pcs4cheap.ca
You should use Directory directives instead and qualify access by where the files are stored in the file system and not by the URL path that access them.
PermalinkPermalink 2009-11-19 @ 22:00

Leave a comment:

Your email address will not be displayed on this site.
Your URL will be displayed.

Allowed XHTML tags: <p, ul, ol, li, dl, dt, dd, address, blockquote, ins, del, span, bdo, br, em, strong, dfn, code, samp, kdb, var, cite, abbr, acronym, q, sub, sup, tt, i, b, big, small>
(Line breaks become <br />)
(Set cookies for name, email and url)
(Allow users to contact you through a message form (your email will NOT be displayed.))
This is a captcha-picture. It is used to prevent mass-access by robots.

Please enter the characters from the image above. (case insensitive)

MHProject v2.0

Blog referente al grupo de investigación y desarrollo (MHProject) realizado en la Universidad Pública de Navarra por más de 12 personas. El proyecto se basa en el desarrollo e investigación de aplicaciones y sistemas para Televisión Digital Interactiva desarroladas sobre Java y basadas en el estandard abierto MHP (Multimedia Home Platform).

Alejandro Fanjul Hola que tal soy Alejandro Fanjul, webmaster y fundador de MHProject, para cualquier consulta por favor dirigirse a: alex.fanjul@mhproject.org


Mi currículum vítae.(pdf)


Recomiéndanos en Twitter!!

Marzo 2010
Lun Mar Mie Jue Vie Sab Dom
<< <     
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31      

Añade el calendario de MHProject
a tu Google Calendar.

Buscar

MHPenlaces

PresentacionesDocumentaciónLinks (Enlaces)

Otros

Sindicar esta bitácora XML

What is RSS?

Who's Online?

  • Guest Users: 7

powered by
b2evolution

Creative Commons License
Esta obra está bajo una licencia de Creative Commons.