You will get error:
[emerg] "access_log" directive is not allowed here.
# Create logfile google.log
# And set access rights
touch /var/log/nginx/google.log
chown www-data:www-data /var/log/nginx/google.log
# Add configuration to " sites-enabled/[your_site_name] "
# It must be inside of " server " block.
nano /etc/nginx/sites-enabled/wordpress
#----------------Configuration Code-------------------#
# LOG google bot seperate #
if ($http_user_agent ~* (googlebot) ) {
set $crawler 'yes';
}
location ~ .* {
if ($crawler = 'yes') {
access_log /var/log/nginx/google.log;
return 200;
}
}
#----------------Configuration Code-------------------#
0 comments :
Post a Comment
Comment: