'auto'rewrite link to a folder
bodomic
nginx-forum at nginx.us
Fri Aug 15 07:22:47 UTC 2014
I think your current config is too complicated now so that your regular
expressions do not do what you think they should.
Try a separate server setup in this manner:
server {
listen 80 default;
server_name .example.com;
set $project www;
set $user www-data;
if ($host ~* ^([^.]+)\.([^.]+)\.example\.com$) {
set $project $1;
set $user $2;
}
if (!-d /home/$user/sites/$project/public) { rewrite ^(.*)$
http://www.example.com permanent; }
root /home/$user/sites/$project/public;
index index.php index.htm index.html;
}
Create some dns names like user1.www.example.com (or just put them to your
local hosts file) all pointing to the same host.
Create folders /home/user1/sites/www/public and put index.html stating "This
is a home of user1" there.
Make sure you have access and error logs.
It should work.
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,252553,252585#msg-252585
More information about the nginx
mailing list