Starting nginx: 2009/03/13 15:26:32 4382#0: unknown log format "main"

Hi Guys,

Im using the latest nginx 4.
Here is the error that I am getting:

Starting nginx: 2009/03/13 15:19:55 [emerg] 4378#0: unknown log format
“main” in /etc/nginx/sites-enabled/p1/payam_70.33.253.5.conf:21

My Main nginx.conf config:

user www-data;

worker_processes 4;

worker_rlimit_nofile 20480;

#error_log logs/error.log;

#error_log logs/error.log notice;

#error_log logs/error.log info;

#pid logs/nginx.pid;

events {

    use epoll;

worker_connections 81920;

}

http {

include    proxy.conf;

include       mime.types;

include /etc/nginx/sites-enabled/p1/*.conf;

include /etc/nginx/sites-enabled/ypf/*.conf;



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;

tcp_nodelay on;

keepalive_timeout 45;

------------------------------------------#

HTTP Server

Default

 server {

    listen       x.x.x.x:80;

    server_name  nyc-fwmproxy-1;

root /var/www;

     access_log      /var/log/nginx/nyc-fwmproxy-1.access_log main;

     error_log       /var/log/nginx/nyc-fwmproxy-1.error_log info;



     location / {

                    }

}

------------------------------------------#

}

EOF

Here is my Config for “payam_70.33.253.5.conf”:

loadbalancers

for the LB naming, include the ip address so its uniq

HTTP LB

upstream LB_HTTP_70.33.253.5 {

server x.x.x.x:80 weight=3;

server x.x.x.x:80;

}

HTTPS LB

upstream LB_HTTPS_70.33.253.5 {

server x.x.x.x:443;

server x.x.x.x:443;

}

HTTP server

server {

    listen       70.33.253.5:80;

    server_name  www.bhsecurity.com;



     access_log      /var/log/nginx/any.payam.access_log main;

     error_log       /var/log/nginx/any.payam.error_log info;



     location / {

     proxy_pass              http://LB_HTTP_70.33.253.5;

     }

}

HTTPS server

server {

    listen       70.33.253.5:443;

    server_name  www.bhsecurity.com;



     access_log      /var/log/nginx/any.payam.access_log main;

     error_log       /var/log/nginx/any.payam.error_log info;



     ssl                  on;

     ssl_certificate 

/etc/nginx/sites-enabled/ssl/ypf/payam/payam.crt;

     ssl_certificate_key 

/etc/nginx/sites-enabled/ssl/ypf/payam/payam.key;

     location / {

     proxy_pass             https://LB_HTTPS_70.33.253.5;

     }

}

What am i doing wrong here? any help would greatly be appreciated
Thanks,
Payam

Hello!

On Fri, Mar 13, 2009 at 03:26:50PM -0700, Payam C. wrote:

Im using the latest nginx 4.
Here is the error that I am getting:

Starting nginx: 2009/03/13 15:19:55 [emerg] 4378#0: unknown log format
“main” in /etc/nginx/sites-enabled/p1/payam_70.33.253.5.conf:21

My Main nginx.conf config:

user www-data;

[…]

http {

include    proxy.conf;

include       mime.types;

include /etc/nginx/sites-enabled/p1/*.conf;

include /etc/nginx/sites-enabled/ypf/*.conf;

Includes with servers{} using log_format main are above definition
of log_format. You should move them below.

[…]

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

                  '"$status" $body_bytes_sent "$http_referer" '

                  '"$http_user_agent" "$http_x_forwarded_for"';

[…]

Maxim D.

On Fri, Mar 13, 2009 at 03:26:50PM -0700, Payam C. wrote:

#error_log logs/error.log notice;

http {

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"';

You need to set log_format before

 include /etc/nginx/sites-enabled/p1/*.conf;

 include /etc/nginx/sites-enabled/ypf/*.conf;