Archive

Posts Tagged ‘apache’

Apache: mod_python

October 18, 2009 Leave a comment


apache_logo



One of the most interesting ways to use python is the Apache’s mod_python module. The mod_python module actually embeds a fully functional python intrepreter inside the apache web server.
This is most frequently used as powerful means to generate dynamic web pages.


The most common method of generating dynamic web pages is the CGI script. A CGI page is invoked each time a given page is requested. It reads the request, generates a reply and then terminates. This mimics the operation of HTTP, which at its core, works with a single request at a time. The next time a request is received, the CGI script is again invoked from scratch. This design enables the CGI script to be both language and server neutral. indeed all popular web servers and programming languages support them.


However this compatibility comes at a price & performance, Starting up a CGI script is slow. There’s operating system overhead involved while creating a new process. There’s overhead from the python interpreter when initializing and loading the script. CGI script that connect to databases hit especially hard, since they must establish new database connection each time a page is displayed. For these reasons CGI scripts are not suitable for high traffic sites.


mod_python


The mod_python module is one answer to these problems. It actually embeds a full python interpreter inside the apache web server. your scripts are loaded only once per server process and only initialized then. Database connections can be established at the time of initialization and can be kept open throughout the life of web server process. whenever a page needs to be generated, a particular function is called, all data about the request is passed to it. This function has access to the environment created at the initialization time. so, for instance it can reuse the existing database connection.


while this scheme forces the use of apache web server, its advantage often outweigh its disadvantages, Read more…

creating a ssl certificate

September 23, 2008 3 comments

SSL
A little tutorial on creating an SSl certificate, you can also generate your own self signed certificate to be used in the intranet or for demo :-

1) The first step is to create your RSA Private Key. This key is a 4096 bit RSA key which is encrypted using Triple-DES and stored in a PEM format so that it is readable as ASCII text.

>> openssl genrsa -des3 -out domainname.com.key 4096

Once you run the above command, it will ask you to enter a Pass phrase for your domain key file.

2) Generating a CSR   (Certificate signing request)  :-

Once the private key is generated a Certificate Signing Request can be generated. The CSR is then used in one of two ways. Ideally, the CSR will be sent to a Certificate Authority, such as Thawte or Verisign who will verify the identity of the requestor and issue a signed certificate. or you can use it to create your own self signed certificate for intranets or for demo purpose.

These are the X.509 attributes of the certificate. One of the prompts will be for “Common Name (e.g., YOUR name)”. It is important that this field be filled in with the fully qualified domain name of the server to be protected by SSL. If the website to be protected will be https://domainname.com, then enter domainname.com at this prompt. If you want to create a so called “wildcard” certificate, which means the same certificate can be used on an unlimited number of subdomains, just enter an asterisk as the hostname, in our example that would be *.domainname.com.

Read more…

Categories: Linux Tags: , , ,
Follow

Get every new post delivered to your Inbox.