# Help needed with config

**URL:** <https://www.ruby-forum.com/t/help-needed-with-config/237300>\
**Category:** NGINX\
**Created:** [November 4, 2013, 6:37pm UTC](https://www.ruby-forum.com/t/help-needed-with-config/237300 "2013-11-04T18:37:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [November 4, 2013, 6:37pm UTC](https://www.ruby-forum.com/t/help-needed-with-config/237300/1 "2013-11-04T18:37:47Z")

</div>

Hi,

I’m baffled. What I want to do is to serve static and php files from one  
root if they exist there, and  
from another if they don’t, and give a 404 error if the file is in  
neither location. I have the following config file.

server {  
server\_name reseller.anake.hcs;  
listen 80;  
fastcgi\_read\_timeout 300;  
index index.php;  
set $resellerroot “/home/ian/websites/reseller/htdocs”;  
set $centralroot “/home/ian/websites/coachmaster3dev/htdocs”;  
root $resellerroot;  
# if / then redirect to index.php  
location = / {  
# serve /index.php  
rewrite ^ /index.php last;  
}  
# if local php file exits, serve with fcgi  
location ~ .php$ {  
try\_files $uri $uri/ @masterphp;  
fastcgi\_pass 127.0.0.1:9000;  
fastcgi\_param SCRIPT\_FILENAME  
$document\_root$fastcgi\_script\_name;  
fastcgi\_param CENTRAL\_ROOT $centralroot;  
fastcgi\_param RESELLER\_ROOT $resellerroot;  
include /etc/nginx/fastcgi\_params;  
}  
# serve php file from master root  
location @masterphp {  
root $centralroot;  
try\_files $uri $uri/ =404;  
fastcgi\_pass 127.0.0.1:9000;  
fastcgi\_param SCRIPT\_FILENAME  
$centralroot$fastcgi\_script\_name;  
fastcgi\_param CENTRAL\_ROOT $centralroot;  
fastcgi\_param RESELLER\_ROOT $resellerroot;  
include /etc/nginx/fastcgi\_params;  
}  
# serve local static files if they exist  
try\_files $uri @masterstatic;  
# switch to master set when they don’t  
location @masterstatic {  
root $centralroot;  
try\_files $uri =404;  
}  
# now to configure the long polling  
push\_store\_messages on;  
location /publish {  
push\_publisher;  
set $push\_channel\_id $arg\_id;  
push\_message\_timeout 30s;  
push\_max\_message\_buffer\_length 10;  
}  
# public long-polling endpoint  
location /activity {  
push\_subscriber;  
push\_subscriber\_concurrency broadcast;  
set $push\_channel\_id $arg\_id;  
default\_type text/plain;  
}  
}

It gives me "No input file specified. " for _all_ inputs - and I mean  
all. Files in $centralroot,  
files in $resellerroot, files in neither, static files, and php files.

Why? What am I doing silly???

I’m using nginx 1.2.6, compiled with the Comet module included.

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:** [November 4, 2013, 8:02pm UTC](https://www.ruby-forum.com/t/help-needed-with-config/237300/2 "2013-11-04T20:02:29Z")

</div>

On Mon, Nov 04, 2013 at 05:37:15PM +0000, Ian H. wrote:

Hi there,

> I’m baffled. What I want to do is to serve static and php files from one  
> root if they exist there, and  
> from another if they don’t, and give a 404 error if the file is in  
> neither location. I have the following config file.

> It gives me "No input file specified. " for _all_ inputs - and I mean  
> all. Files in $centralroot,  
> files in $resellerroot, files in neither, static files, and php files.
> 
> Why? What am I doing silly???

Not using that config file, that server block, or that nginx?

> I’m using nginx 1.2.6, compiled with the Comet module included.

With

$ sbin/nginx -V  
nginx version: nginx/1.2.6  
built by gcc 4.4.5 (Debian 4.4.5-8)  
configure arguments: --with-debug  
–add-module=…/nginx\_http\_push\_module-0.692/

it happily serves local files and php scripts for me.

What does the debug log say is happening, when you use “curl” to access  
one specific url?

## f

Francis D. removed\_email\_address@domain.invalid

---

<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:** [November 4, 2013, 8:24pm UTC](https://www.ruby-forum.com/t/help-needed-with-config/237300/3 "2013-11-04T20:24:05Z")

</div>

Hi Francis,

Your guess was spot on. I had domain “resellerdev.anake.hcs” confused  
with “reseller.anake.hcs” , becasue of a switch about on my favourites  
menu ☹

Thanks.

Ian

On 04/11/2013 19:01, Francis D. wrote:

> > files in $resellerroot, files in neither, static files, and php files.  
> > configure arguments: --with-debug --add-module=…/nginx\_http\_push\_module-0.692/
> 
> it happily serves local files and php scripts for me.
> 
> What does the debug log say is happening, when you use “curl” to access  
> one specific url?
> 
> f

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