location not allowed here?

jeff emminger jemminger at gmail.com
Fri Jul 11 04:35:33 MSD 2008


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;

  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;
  }
}





More information about the nginx mailing list