Archive for the ‘System’ Category

How to handle SVN with Redmine

septembre 15th, 2011

When it comes to project management, Redmine is one of the best tools according to me. Written in Ruby on Rails, it offers a huge amount of features in a clean, really nice and efficient interface. Plus it’s free and open source.

One of these features is related to Subversion. Redmine is able to interact with Subversion:

  • it has a powerful repository browser able to link tasks and commits.
  • it can manage SVN authentication. Redmine users have therefore access to the SVN repository with same username and password

In order to setup up this feature, you must follow this tutorial: http://www.redmine.org/projects/redmine/wiki/HowTo_to_handle_SVN_repositories_creation_and_access_control_with_Redmine

Sadly, this is not that simple. This tutorial doesn’t work on recent versions of Redmine (see post here: http://www.redmine.org/boards/2/topics/24383?r=26204). Redmine has updated it authentication system in adding a salt field. Initially, Redmine passwords were SHA1(password) only. Now passwords are SHA1(salt.SHA1(password)). This format is not supported by pam_mysql out of the box.

I’ve therefore patched pam_mysql.c. Patch is here: http://pastebin.com/4SATdQ8u

In order to use it, you must:

  1. download pam_mysql source here
  2. apply the attached patch on pam_mysql.c using the « patch » command
  3. compile again pam_mysql: « make clean && make && make install »
  4. modify the MySQL ssh_users view running this SQL query:
    CREATE OR REPLACE VIEW ssh_users as
    select login as username, CONCAT(hashed_password, '|', salt) as password
    from users
    where status = 1;
  5. edit /etc/pam.d/sshd and set crypt=5 for the 3 blocks

Auth will now take the salt into account. For pam_mysql-0.7RC1 only.
Let me know whether it works

Tags: , , , , ,
Posted in System, Technology | Comments (0)

WordPress 3 nginx virtualhost configuration

juin 22nd, 2011

Hi there,

another configuration file for WordPress 3 running on Nginx:


server
        {
                listen 80;
                server_name blog.******.com;
                root /var/www/blog;
                index index.php;

                location /
                {
                        try_files $uri $uri/ @wordpress;
                }

                # BLOCKS ACCESS TO . FILES (.svn, .htaccess, ...)
                location ~ /\. {
                        deny  all;
                }

                # FOR PHP FILES
                location ~* \.php$ {
                        try_files $uri $uri/ @wordpress;

                        fastcgi_pass 127.0.0.1:9000;
                        fastcgi_index index.php;
                        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                        include fastcgi_params;
                }

                location @wordpress {
                        fastcgi_pass 127.0.0.1:9000;
                        #fastcgi_index index.php;
                        include fastcgi_params;
                        fastcgi_param SCRIPT_FILENAME  $document_root/index.php;
                        break;
                }

                location ~ /\. {
                        deny  all;
                }

                location ~* \.css|\.js|\.jpg|\.jpeg|\.png|\.gif|\.swf|\.svg|\.tiff$ {
                        expires 30d;
                }
}

There you go!

Tags: , , ,
Posted in System, Technology | Comments (0)

Sphinx accentuated characters

septembre 6th, 2010

When indexing like me french content into Sphinx, accentuated and non-accentuated search queries will not return the same results. For instance, searching on « Môle » returns a result unlike a search on « Mole ».
Read the rest of this entry »

Posted in System, Technology | Comments (0)

Kohana with Nginx – VirtualHost configuration

juin 10th, 2010

In order to improve performances, I chose to switch web server for one of my websites. I switched from Apache 2 to Nginx, extremely fast and powerful. It’s not easy to configure though: it took me a really long time to configure Nginx for Kohana 2. Here is my configuration file:

server {
	listen 80;
	server_name www.xxxx.com;
	root /var/www/xxxx/prod/public;
	index index.php;

	# ROUTING TO KOHANA IF REQUIRED
	location / {
		try_files $uri $uri/ @kohana;
	}

	# BLOCKS ACCESS TO . FILES (.svn, .htaccess, ...)
	location ~ /\. {
		deny  all;
	}

	# FOR PHP FILES
	location ~* \.php$ {
	 	# PHP FILES MIGHT BE TO HANDLED BY KOHANA
		try_files $uri $uri/ @kohana;

		fastcgi_pass 127.0.0.1:9000;
		fastcgi_index index.php;
		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
		include fastcgi_params;
	}


	# HANDLES THE REWRITTEN URLS TO KOHANA CONTROLLER
	location @kohana
	{
		fastcgi_pass 127.0.0.1:9000;
		fastcgi_index index.php;
		include fastcgi_params;
		fastcgi_param SCRIPT_FILENAME $document_root/index.php;
	}


	# CACHE CONTROL FOR STATIC FILES
	location ~* \.css|\.js|\.jpg|\.jpeg|\.png|\.gif|\.swf|\.svg|\.tiff|\.pdf$ {
		expires 30d;
	}

	# REDIRECTING MEDIAS TO STATIC
	location ^~ /medias/ {
		rewrite ^/medias/(.*) http://static.xxxx.com/$1 permanent;
		break;
	}

}



server {
	listen 80;
	server_name static.xxxx.com;
	root /var/www/xxxx/medias/;    
	expires 90d;

	location /videos/ {
		keepalive_timeout     200 190;

		#limit_conn   videos  2;
		mp4;
		limit_rate_after 512k;
		limit_rate 512k;

		error_page 404 = /videos/video_not_found.png;
	}
}

My homepage now loads in 1,5s instead of 7s before. Thanks to Nginx ;-)

Tags: , , , ,
Posted in System, Technology | Comments (2)