Nginx: mass permanent redirects

When I say “mass”, I mean reasonable amount of redirects, like a couple of thousands. I had to migrate a blog to a new URL structure. This migration led to create about 600+ unique redirects without any shared patterns. To solve this, I used a nginx configuration file containing all the redirects and I included … 

 

How to configure HTTPS/SSL under Apache and OSX

My setup : OSX : 10.8.5 Apache : # httpd -V Server version: Apache/2.2.26 (Unix) Server built: Dec 10 2013 22:06:35 Server’s Module Magic Number: 20051115:33 Server loaded: APR 1.4.5, APR-Util 1.3.12 Compiled using: APR 1.4.5, APR-Util 1.3.12 Architecture: 64-bit Server MPM: Prefork threaded: no forked: yes (variable process count) Server compiled with…. -D APACHE_MPM_DIR=”server/mpm/prefork” … 

 

Remove trailing slash with Apache

With Apache and mod_rewrite, to avoid urls like /page1 and /page1/ to respond with the same content, you can use mod_rewrite with the following syntax: # Remove trailing slash RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]

 

Add a C header include path to compile PECL extensions

I needed to use ImageMagick with PHP on Mac OS X. Using homebrew I added ImageMagick to my system as follow : $ brew install imagemagick And then, add the PHP extension with PECL : sudo pecl install imagick Bad luck… cc -I. -I/private/tmp/pear/temp/imagick -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-rootSqBVOk/imagick-3.0.1/include -I/private/tmp/pear/temp/pear-build-rootSqBVOk/imagick-3.0.1/main -I/private/tmp/pear/temp/imagick -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g … 

 

Permanent redirect with Apache and mod_rewrite

Redirect old url to a new url RewriteEngine On RewriteRule /oldurl /newurl [R=301,L] Canonical domain rewriting RewriteEngine On RewriteCond %{HTTP_HOST} ^domain\.com$ [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]   See also Apache module mod_rewrite documentation Permanent redirect with nginx Permanent redirect with lighttpd  

 

Amazon is moving into CDN market

As read in Diamond Notes, Amazon is moving into CDN market with CloudFront. Some Content Delivery Network providers Akamaï Akamaï on Crunchbase BitGravity BitGravity on Crunchbase EdgeCast Networks EdgeCast Networks on Crunchbase Limelight Network Limelight Network on Crunchbase Panther Express Panther Express on Crunchbase

 

Fix nginx increase server_names_hash_bucket_size error

When adding new virtual hosts in your nginx configuration file, you can experience this error message: # nginx -t 2008/11/13 09:37:03 [emerg] 12299#0: could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32 2008/11/13 09:37:03 [emerg] 12299#0: the configuration file /etc/nginx/nginx.conf test failed server_names_hash_bucket_size controls the maximum length of a virtual host entry (ie the …