Welcome! Log In Create A New Profile

Advanced

Hot to get access_log off; to work?? Huge!!

Posted by wminside 
Hot to get access_log off; to work?? Huge!!
March 04, 2010 08:05PM
My access_log file is getting HUGE by the second! I've spent the last couple of hours reading docs and access_log off does not work for me. I've tried to put it everywhere. I've tried everything. I'm also looking for performance so /dev/null probably wont do the trick.

I'm running nginx-0.6.39-2.el5 on CentOS 5.4

My nginx.conf
[code]
#######################################################################
#
# This is the main Nginx configuration file.
#
# More information about the configuration options is available on
# * the English wiki - http://wiki.codemongers.com/Main
# * the Russian documentation - http://sysoev.ru/nginx/
#
#######################################################################

#----------------------------------------------------------------------
# Main Module - directives that cover basic functionality
#
# http://wiki.codemongers.com/NginxMainModule
#
#----------------------------------------------------------------------

user nginx;
worker_processes 8;

error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;

pid /var/run/nginx.pid;



#----------------------------------------------------------------------
# Events Module
#
# http://wiki.codemongers.com/NginxEventsModule
#
#----------------------------------------------------------------------

events {
worker_connections 1024;
}


#----------------------------------------------------------------------
# HTTP Core Module
#
# http://wiki.codemongers.com/NginxHttpCoreModule
#
#----------------------------------------------------------------------

http {
include /etc/nginx/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"';

access_log off;
#access_log /var/log/nginx/access.log main;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;

# Load config files from the /etc/nginx/conf.d directory
include /etc/nginx/conf.d/*.conf;

#
# The default server
#
server {
listen 80;
server_name my.server;
index index.html index.htm index.php;

access_log off;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root /usr/share/nginx/html;
#index index.html index.htm index.php;

access_log off;

#WORDPRESS + WP SUPER CACHE
if (-f $request_filename) {
break;
}

set $supercache_file '';
set $supercache_uri $request_uri;

if ($request_method = POST) {
set $supercache_uri '';
}

# Using pretty permalinks, so bypass the cache for any query string
if ($query_string) {
set $supercache_uri '';
}

if ($http_cookie ~* "comment_author_|wordpress|wp-postpass_" ) {
set $supercache_uri '';
}

# if we haven't bypassed the cache, specify our supercache file
if ($supercache_uri ~ ^(.+)$) {
set $supercache_file /wp-content/cache/supercache/$http_host/$1index.html;
}

# only rewrite to the supercache file if it actually exists
if (-f $document_root$supercache_file) {
rewrite ^(.*)$ $supercache_file break;
}

# all other requests go to Wordpress
if (!-e $request_filename) {
rewrite . /index.php last;
}

}

#VBULLETIN + VBSEO + VBSEO SITEMAP
location /foros/ {
#index index.html index.htm index.php;
access_log off;

rewrite ^/foros/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ /foros/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last;

if ($request_filename ~ "\.php$" ) {
rewrite ^(.*)$ /foros/vbseo.php last;
}

if (!-e $request_filename) {
rewrite ^/foros/(.*)$ /foros/vbseo.php last;
}

}

error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$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;
}

if ($host !~* ^www\.) {
rewrite ^(.*)$ http://www.$host$1 permanent;
}

}
}
[/code]
Re: Hot to get access_log off; to work?? Huge!!
March 05, 2010 11:42AM
It looks to me also like it should work.

You ought to consider upgrading to latest stable or development version. That might fix the problem. If you did then you could also well improve performance using try_files instead of some if statements. See http://wiki.nginx.org/IfIsEvil.

Also, for better performance I would eliminate

[code]
if ($host !~* ^www\.) {
rewrite ^(.*)$ http://www.$host$1 permanent;
}
[/code]

and instead use:

[code]
server {
listen 80;
server_name www.myserver.com;
...
}

server {
listen 80;
server_name myserver.com;
rewrite ^ http://www.myserver.com$request_uri?;
}
[/code]

This is a more efficient way of doing this rewrite.

--
Jim Ohlstein
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 207
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready