Installing SOLR 4.9 with Tomcat 7 on Debian Wheezy

First of all, let's install Java: apt-get install openjdk-7-jre-headless Installing Tomcat: apt-get install tomcat7 tomcat7-admin You should now be able to open http://<your-ip>:8080/ in a web browser. Configuring Tomcat manager auth: The tomcat7-admin package comes with two web apps: Web Application Manager and Virtual Host Manager. For security reasons none of them are accessible by […]

Storing your PHP sessions using Memcached

Memcached is a high-performance, distributed memory object caching system. Many big well-known sites use it to store their PHP sessions in a centralized way and to reduce the load on their servers. Installation with Apache2 and PHP5 on Debian: Install these packages (if memcached is on a different server, omit the package): apt-get install memcached php5-memcached Then […]

Redirecting to https using .htaccess

Based on HTTPS variable: RewriteCond %{HTTPS} !=on RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L] Redirect everything that's not being served on port 443 to https: RewriteCond %{SERVER_PORT} !^443$ RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L] Redirect everything served on port 80 to https: RewriteCond %{SERVER_PORT} ^80$ RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

Mass Virtual Hosting with mod_rewrite RewriteMap and PHP

Here is a simple possibility to control a lot of virtual hosts using a simple PHP script to map them to the right path. First of all you need to make sure that mod_rewrite is loaded: a2enmod rewrite Further we need these packages: php5-cli php5-mysql mysql-server What we're doing now is a simple Url-Rewriting to a […]

Dynamic subdomains with mod_vhost_alias

For those using a development server for quite a lot of domains or those using some kind of mass hosting, not wanting to reconfigure each and single domain, this module might be interesting: od_vhost_alias First of all we need to activate the module which is by default included in the apache2 installation: a2enmod vhost_alias Then […]

Wildcard domains with Apache2

Here is a simple way to have wildcard domains in your apache config: Given you're having a webmail application on your server that you would like to use for all of your domains, you could do it as follows: <VirtualHost webmail.example.net:80>   ServerName webmail.example.net   ServerAlias webmail.*   ServerAdmin admin@example.net   DocumentRoot /var/www/webmail   <Directory […]