背景:
阅读新闻
Nginx日志问题解决方法记录
[日期:2012-06-17] 来源:Linux社区 作者:itnihao [字体:]
nginx版本信息如下
#nginx -V nginx version: nginx/1.2.0 最新稳定版本 built by gcc 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC) TLS SNI support enabled configure arguments: --prefix=/usr --sbin-path=/usr/sbin --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-ath=/var/log/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --user=www --group=www --with-http_ssl_module --with-ttp_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_stub_status_module --with-google_perftools_module --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fcgi --http-client-body-temp-path=/var/tmp/nginx/client --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi
nginx的配置如下
user www; worker_processes 2; google_perftools_profiles /var/tmp/nginx/tcmalloc/tcmalloc; events { use epoll; worker_connections 51000; } http { include mime.types; default_type application/octet-stream; keepalive_timeout 65; sendfile on; tcp_nopush on; tcp_nodelay on; client_header_timeout 10; client_body_timeout 10; send_timeout 10; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.1; gzip_comp_level 2; gzip_types text/plain application/x-Javascript text/css applocation/xml; server { listen 80; server_name localhost; location / { root html; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/html$fastcgi_script_name; include fastcgi_params; } log_format welog '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log weblog; } } 启动nginx的时候,出现警告信息#service nginx restart nginx: [warn] the "log_format" directive may be used only on "http" level in /etc/nginx/nginx.conf:97 nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful Stopping nginx: [ OK ] Starting nginx: nginx: [warn] the "log_format" directive may be used only on "http" level in /etc/nginx/nginx.conf:97 [ OK ] 这里的警告意思是日志需要放在http内,所以做如下更改即可
相关资讯 Nginx配置
本文评论 查看全部评论 (0)
尊重网上道德,遵守中华人民共和国的各项有关法律法规 承担一切因您的行为而直接或间接导致的民事或刑事法律责任 本站管理人员有权保留或删除其管辖留言中的任意内容 本站有权在网站内转载或引用您的评论 参与本评论即表明您已经阅读并接受上述条款
评论声明
最新资讯