Category: sysadmin

How to run OpenVpn and a webserver (Apache, Nginx, Cherokee, etc) in the same port


If you have ever used OpenVpn you know that a lot of filtered network do not allow to connect to other ports rather than 80 and 443 TCP. If you have your OpenVpn server in the same machine alongside with a Webserver this may be a problem because you want to use port 80 and 443 for your webserver and also the openvpn.

OpenVpn developers are smart people and they knew that this situation is not so odd so they invented a special option to deal with it. Thanks the article at I found the port-share option that just redirect all the packets that are not vpn ones to another host:port pair. This allows to run your webserver in a different port, let’s say 8443 and make OpenVpn run on the 443 TCP. If packets are not for the vpn they will get redirected to the 8443.

To do so just configure your webserver to listen to port 8443 and add this configuration to the openvpn configuration file (usually /etc/openvpn/server.conf):

proto tcp
port 443
port-share 8443

Then restart openvpn and your webserver and you should be all set.

How to switch to different python version on apache mod_wsgi

By default the ubuntu-debian package of libapache-mod-wsgi contains the wsgi apache module compiled for either python 2.6 and python 2.7. This makes really easy to switch between python 2.6 or python 2.7 support in webapps. Indeed you have just to change a symbolic link to make your application working with python 2.7 interpreter if python 2.6 is enabled by default.
As you can see the libapacke2-mod-wsgi package countains both the 2.6 and 2.7 version of the the modules.
Se let's see how to accomplish this:
vincenzo@mba:/usr/lib/apache2/modules$ ls
vincenzo@mba:/usr/lib/apache2/modules$ file symbolic link to `'
vincenzo@mba:/usr/lib/apache2/modules$ sudo ln -fs
Finished: we created file which is a symbolic link to Now your reboot apache with sudo apache2ctl restart and you are using python 2.7 ;)
%d bloggers like this: