Help with convert .htaccess to nginx :(

makononov nginx-forum at nginx.us
Wed Mar 21 19:54:28 UTC 2012


I realize I'm responding to an old thread here, but thought I would post
the configuration that I used to get this working:

	location / {
		try_files $uri $uri/ /index.php$uri?$args;
	}

	location = /robots.txt { access_log off; log_not_found off; }
	location = /favicon.ico { access_log off; log_not_found off; }
	location ~ /\. {access_log off; log_not_found off; deny all; }
	location ~ \.(lock|conf)$ { access_log off; log_not_found off; deny
all; }
	location ~ pre_.+\.php { access_log off; log_not_found off; deny all;
}
	location = /test_rewrite1.txt { rewrite ^ /test_rewrite2.txt; }

	location /js/i18n {
		autoindex on;
	}

	location ~ \.php {
		include fastcgi.conf;
		fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
		fastcgi_param PATH_INFO $fastcgi_path_info;
		fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
		fastcgi_pass unix:/tmp/php-fpm.sock;
	}

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,217447,224195#msg-224195



More information about the nginx mailing list