phpBB configuration problem under Nginx
- by zvikico
Hi,
I have a phpBB site running with Nginx (PHP via FastCGI). It works OK. However, some specific actions like moving or deleting a topic fail. Instead, I'm redirected to the forum index.
I think it is a problem with the URLs redirection or rewriting. My rewrite rule looks like this:
if (!-e $request_filename) {
     rewrite  ^/(.*)$  /index.php?q=$1  last;
     break;
}
Any help would be appreciated.
My full configuration file is:
server {
listen	 80;
server_name forum.xxxxx.com;
access_log /xxxxx/access.log;
error_log /xxxxx/error.log;
location = / {
	root	 	/xxxxx/phpBB3/;
	index  		index.php;
}
location / {
	root	 	/xxxxx/phpBB3/;
	index  		index.php index.html;
	if (!-e $request_filename) {
     	rewrite  ^/(.*)$  /index.php?q=$1  last;
        break;
	}	     
}
error_page  404         		/index.php;
error_page  403		   	/index.php;     
error_page  500 502 503 504  	/index.php;
# serve static files directly                                      
location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico)$ {
	access_log        off;
	expires           30d;
	root /xxxxx/phpBB3/;
    break; 
}
# hide protected files
location ~* \.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template)$ {
    	deny all;
}
location ~ \.php$ {
	fastcgi_pass   127.0.0.1:8888;  
	fastcgi_index  index.php;
	fastcgi_param  SCRIPT_FILENAME  /xxxxx/phpBB3/$fastcgi_script_name; 
	fastcgi_param  QUERY_STRING     $query_string;
	fastcgi_param  REQUEST_METHOD   $request_method;
	fastcgi_param  CONTENT_TYPE     $content_type;
	fastcgi_param  CONTENT_LENGTH   $content_length;
	fastcgi_param  REMOTE_ADDR        $remote_addr;
	fastcgi_param  REMOTE_PORT        $remote_port;
}
}