Location not allowed here?

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


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;



server {
listen 80;

server_name 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

location ~ .php$ {
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
include fastcgi_params;

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

concurs with nginx’s one

location ~ /.ht {
deny all;

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