"access_log" directive is not allowed here in... how to do this properly?

Micheal Wolfskill tdgh2323 at hotmail.com
Sun Mar 25 19:21:20 UTC 2012


Hello !

Iam trying to log the requests coming from a list of countries into a seperate log file.. Iam using the config below... BUt iam getting this error: 

[emerg]: "access_log" directive is not allowed here in /etc/nginx/nginx.conf:55
configuration file /etc/nginx/nginx.conf test failed

How could I accomplish what iam trying to do?

Thanks!

--Mike


http {
         ......
         .......

geoip_country  /etc/nginx/GeoIP.dat; 
       
map $geoip_country_code $log {
                        default       0;
                        CN 1; #"China"
                        RO 1; #"Romania"
                        IQ 1; #"Iraq"
                        IR 1; #"Iran
                        HK 1; #"Hong Kong"
                        IN 1; #"India"
                        }

        server {
                listen   80;
                server_name  domain.com;
                .....
                .....
                if ($log) { access_log  /root/access-selected-slim.log; }
                location / { proxy_pass http://12.163.169.32:80/;  }

                }
     }

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20120325/d2d22d90/attachment.html>


More information about the nginx mailing list