# nginX - public\_html - multiple CMS

**URL:** <https://www.ruby-forum.com/t/nginx-public-html-multiple-cms/201151>\
**Category:** NGINX\
**Created:** [December 31, 2010, 5:14pm UTC](https://www.ruby-forum.com/t/nginx-public-html-multiple-cms/201151 "2010-12-31T17:14:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [December 31, 2010, 5:14pm UTC](https://www.ruby-forum.com/t/nginx-public-html-multiple-cms/201151/1 "2010-12-31T17:14:14Z")

</div>

Hi  
Can nginX have configuration like apache user’s public\_html ?

I have system where I wanna implement multiple user directory where each  
user can build his own site using Drupal and Wordpress… each with it’s  
own clean url

maybe the result will look like this url:

[mainsite.com](http://mainsite.com/~user_drupal) (/home/user\_drupal/public\_html)  
[mainsite.com](http://mainsite.com/~user_wordpress) (/home/user\_wordpress/public\_html)

Thanks for any help.

Regards, Bonn

Posted at Nginx Forum:

> **[nginX - public\_html - multiple CMS](https://forum.nginx.org/read.php?2,162498,162498#msg-162498)**
>
> Hi Can nginX have configuration like apache user's public\_html ? I have system where I wanna implement multiple user directory where each user can build his own site using Drupal and Wordpress... each with it's own clean url maybe the result will...

---

<div class="post-metadata">

**Author:** ![bonn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/74df32/32.png) [@bonn](https://www.ruby-forum.com/u/bonn)\
**Post date:** [January 1, 2011, 5:00am UTC](https://www.ruby-forum.com/t/nginx-public-html-multiple-cms/201151/2 "2011-01-01T05:00:22Z")

</div>

On Fri, Dec 31, 2010 at 11:13 PM, bonn [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi  
> Can nginX have configuration like apache user’s public\_html ?
> 
> I have system where I wanna implement multiple user directory where each  
> user can build his own site using Drupal and Wordpress… each with it’s  
> own clean url

You don’t want to (do this with nginx). Especially if you can’t trust  
your users.

---

<div class="post-metadata">

**Author:** ![bonn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/74df32/32.png) [@bonn](https://www.ruby-forum.com/u/bonn)\
**Post date:** [January 2, 2011, 9:32am UTC](https://www.ruby-forum.com/t/nginx-public-html-multiple-cms/201151/3 "2011-01-02T09:32:48Z")

</div>

ok, thanks all ^^

Posted at Nginx Forum:

> **[Re: nginX - public\_html - multiple CMS](https://forum.nginx.org/read.php?2,162498,162817#msg-162817)**
>
> Hi Can nginX have configuration like apache user's public\_html ? I have system where I wanna implement multiple user directory where each user can build his own site using Drupal and Wordpress... each with it's own clean url maybe the result will...

---

<div class="post-metadata">

**Author:** ![bonn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/74df32/32.png) [@bonn](https://www.ruby-forum.com/u/bonn)\
**Post date:** [January 1, 2011, 5:36am UTC](https://www.ruby-forum.com/t/nginx-public-html-multiple-cms/201151/4 "2011-01-01T05:36:10Z")

</div>

On 31 Dez 2010 16h13 WET, [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> [http://mainsite.com/~user\_wordpress](http://mainsite.com/~user_wordpress)  
> (/home/user\_wordpress/public\_html)

Assuming that you trust your users enough to let them run PHP code  
here’s a tip from the Wiki: [GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/NginxUserDir)

I suggest a simpler regex (without ? in usernames and the slash out of  
the 1st group).

location ~ ^/~(?.+)/(?.\*)$ {  
alias /home/$username/public\_html/$userpath;  
}

with named capture groups or just:

location ~ ^/~(.+)/(.\*)$ {  
alias /home/$1/public\_html/$2;  
}

with numeric groups.

Note that with drupal you can have multisite installs. Therefore if  
you add an A record to your [domain.com](http://domain.com) zone file like, e.g.,  
[username.domain.com](http://username.domain.com) and make the [domain.com/~username](http://domain.com/~username) URI a 301  
redirect you can run your own core and basic modules and let your  
users create a theme and add modules as they see fit. Anyway it’s your  
machine, so you make the rules.

Happy New Year,  
— appa
