# Location not allowed here?

**URL:** <https://www.ruby-forum.com/t/location-not-allowed-here/142749>\
**Category:** NGINX\
**Created:** [July 11, 2008, 2:49am UTC](https://www.ruby-forum.com/t/location-not-allowed-here/142749 "2008-07-11T02:49:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jemminger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c0e974/32.png) [@jemminger](https://www.ruby-forum.com/u/jemminger)\
**Post date:** [July 11, 2008, 2:49am UTC](https://www.ruby-forum.com/t/location-not-allowed-here/142749/1 "2008-07-11T02:49:18Z")

</div>

using 0.6.31

i’m getting an error trying to start nginx: Starting nginx:  
2008/07/10 20:24:57 [emerg] 2477#0: “location” directive is not  
allowed here in /usr/local/nginx/sites/secure.mysite.conf:35

strange thing is, i’m pretty sure i have the identical setup on  
another server and it’s working fine. it seems to be complaining  
about the “location = /50x.html {” line

# 

# /usr/local/nginx/nginx.conf

# 

worker\_processes 2;

pid logs/nginx.pid;

events {  
worker\_connections 1024;  
}

http {  
include mime.types;  
default\_type application/octet-stream;

log\_format main '$remote\_addr - $remote\_user [$time\_local] $request  
’  
'“$status” $body\_bytes\_sent “$http\_referer” ’  
‘“$http\_user\_agent” “$http\_x\_forwarded\_for”’;

sendfile on;  
tcp\_nopush on;

#keepalive\_timeout 0;  
keepalive\_timeout 65;

gzip on;  
include /usr/local/nginx/sites/\*.conf;

}

# 

# /usr/local/nginx/sites/mysite.conf;

# 

server {  
listen 80;

server\_name [mysite.com](http://mysite.com);

access\_log logs/.mysite.com.access.log main;

location / {  
root /var/www/docs/mysite.com;  
index index.html index.htm index.php;

```
# rewrite old subscribe urls to new (with trailing slash)
  rewrite ^/subscribe([^\/]*)$ /subscribe/index.php$1 permanent;
}

```

}

error\_page 404 /404.html;

# redirect server error pages to the static page /50x.html

# 

error\_page 500 502 503 504 /50x.html;  
location = /50x.html {  
root html;  
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

# 

location ~ .php$ {  
fastcgi\_pass 127.0.0.1:9000;  
fastcgi\_index index.php;  
fastcgi\_param SCRIPT\_FILENAME  
/var/www/docs/mysite.com/secure-qa/$fastcgi\_script\_name;  
include fastcgi\_params;  
}

# deny access to .htaccess files, if Apache’s document root

# concurs with nginx’s one

# 

location ~ /.ht {  
deny all;  
}  
}

---

<div class="post-metadata">

**Author:** ![jemminger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c0e974/32.png) [@jemminger](https://www.ruby-forum.com/u/jemminger)\
**Post date:** [July 11, 2008, 2:56am UTC](https://www.ruby-forum.com/t/location-not-allowed-here/142749/2 "2008-07-11T02:56:19Z")

</div>

nevermind… i seem to be missing an “if (condition) {”… the method  
i’m using to generate the .conf is dropping that for some reason.
