# Help needed with configuration

**URL:** <https://www.ruby-forum.com/t/help-needed-with-configuration/235832>\
**Category:** NGINX\
**Created:** [July 18, 2013, 11:56am UTC](https://www.ruby-forum.com/t/help-needed-with-configuration/235832 "2013-07-18T11:56:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alcina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@alcina](https://www.ruby-forum.com/u/alcina)\
**Post date:** [July 18, 2013, 11:56am UTC](https://www.ruby-forum.com/t/help-needed-with-configuration/235832/1 "2013-07-18T11:56:52Z")

</div>

Hi All,

I am trying to set up Nginx for a reseller scenario. The reseller will  
get his own root, and be able to  
create his versions of any file on the site, or, by leaving the file  
out, simply have the basic one used  
instead. My test configuration is below, and it so nearly works!

The URL reseller.anake.hcs does not result in serving  
…coachmaster3dev/htdocs/index.php as I want,  
but in a 403 Forbidden error.

server {  
server\_name reseller.anake.hcs;  
listen 80;  
fastcgi\_read\_timeout 300;  
index index.php index.html index.htm;  
root /home/ian/websites/reseller/htdocs;  
# don’t serve templates  
location ~ .tpl {  
return 404;  
}  
# handle php  
location ~ .php$ {  
try\_files $uri $uri/ @masterphp;  
fastcgi\_pass 127.0.0.1:9000;  
fastcgi\_param SCRIPT\_FILENAME  
$document\_root$fastcgi\_script\_name;  
include /etc/nginx/fastcgi\_params;  
}  
location @masterphp {  
root /home/ian/websites/coachmaster3dev/htdocs;  
try\_files $uri $uri/ =404;  
fastcgi\_pass 127.0.0.1:9000;  
fastcgi\_param SCRIPT\_FILENAME  
$document\_root$fastcgi\_script\_name;  
include /etc/nginx/fastcgi\_params;  
}  
# try reseller’s static files  
location / {  
try\_files $uri $uri/ @master;  
}  
# switch to master set  
location @master {  
root /home/ian/websites/coachmaster3dev/htdocs;  
try\_files $uri $uri/ =404;  
}  
}

I am using nginx 1.2.6.

How can I get it to work?

Thanks

Ian

---

<div class="post-metadata">

**Author:** ![dcian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@dcian](https://www.ruby-forum.com/u/dcian)\
**Post date:** [July 18, 2013, 12:40pm UTC](https://www.ruby-forum.com/t/help-needed-with-configuration/235832/2 "2013-07-18T12:40:08Z")

</div>

iirc there is something with the order/length of location $var {} -  
content.

is there an index.php in /home/ian/websites/reseller/htdocs?  
what is the dir\_permissions from /home/ian/websites/reseller/htdocs?  
what are the file\_permissions for  
/home/ian/websites/coachmaster3dev/htdocs/index.php?  
what is the dir\_permissions home/ian/websites/coachmaster3dev/htdocs?

403 Forbidden is a trustable output.

Posted at Nginx Forum:

> **[Re: Help needed with configuration](https://forum.nginx.org/read.php?2,240984,240988#msg-240988)**
>
> Hi All, I am trying to set up Nginx for a reseller scenario. The reseller will get his own root, and be able to create his versions of any file on the site, or, by leaving the file out, simply have the basic one used instead. My test configuration is...

---

<div class="post-metadata">

**Author:** ![dcian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@dcian](https://www.ruby-forum.com/u/dcian)\
**Post date:** [July 18, 2013, 8:39pm UTC](https://www.ruby-forum.com/t/help-needed-with-configuration/235832/3 "2013-07-18T20:39:22Z")

</div>

Hi Mex,  
Thanks for your interest.

On 18/07/2013 11:39, mex wrote:

> iirc there is something with the order/length of location $var {} -  
> content.  
> I have tried moving the location / to the first position, but that  
> changed nothing.
> 
> is there an index.php in /home/ian/websites/reseller/htdocs?  
> No, but when I create one, it is served.  
> I don’t want to create one unless it is necessary for reseller’s  
> configuration.  
> what is the dir\_permissions from /home/ian/websites/reseller/htdocs?  
> 775 if I specify the file, it is served as required.  
> what are the file\_permissions for  
> /home/ian/websites/coachmaster3dev/htdocs/index.php?  
> 744  
> what is the dir\_permissions home/ian/websites/coachmaster3dev/htdocs?  
> 777
> 
> * * *
> 
> No virus found in this message.  
> Checked by AVG - [www.avg.com](http://www.avg.com)  
> Version: 2013.0.3349 / Virus Database: 3204/6500 - Release Date: 07/17/13

–  
Ian H.  
31 Sheerwater, Northampton NN3 5HU,  
Tel: 01604 513875  
Preparing eBooks for Kindle and ePub formats to give the best reader  
experience.
