userdir php

Dirk

New member
Joined
Sep 5, 2013
Messages
2
Hi,

For some domains I need to use /~username. It came to my attention that this isn't possible by default in nginx. So I started googling a bit and found some easy code to make it work.

/~username works:
Code:
location ~ ^/~([^/]+)(/.*)?$ {
	alias /home/$1/public_html$2;
	autoindex on;
}

Then I found out that when I call a php script I get a 404 error. After a lot of googling on that problem, I can't get it to work.

Currently I have this:
Code:
location ~ ^/~([^/]+)/(.+\.php)$ {
	if (!-f /home/$1/public_html/$2) {
	rewrite ^ 404;
	}
	alias /home/$1/public_html/$2;
	include /etc/nginx/fastcgi_params;
	fastcgi_index index.php;
	fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
	include /etc/nginx/nginx_limits.conf;
	if (-f $request_filename)
	{
		fastcgi_pass unix:/usr/local/php55/sockets/sitecam202.sock;
	}
}


Can anyone help me out?
 
I know that, but I still need the userdir possibility. Could anyone help me with calling php script on /~user?
 
Back
Top