Editing Nginx.conf
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | + | ||
+ | * Error log file: <code>/var/log/nginx/error.log</code> | ||
+ | * Access log file: <code>/var/log/nginx/access.log</code> | ||
+ | |||
+ | |||
+ | == Track Application Response time in Nginx <ref>https://lincolnloop.com/blog/tracking-application-response-time-nginx/</ref> == | ||
+ | |||
+ | 1) Add to <code>/etc/nginx/nginx.conf</code> | ||
+ | <pre> | ||
+ | log_format timed_combined '$remote_addr - $remote_user [$time_local] ' | ||
+ | '"$request" $status $body_bytes_sent ' | ||
+ | '"$http_referer" "$http_user_agent" ' | ||
+ | '$request_time $upstream_response_time $pipe'; | ||
+ | </pre> | ||
+ | |||
+ | 2) Modify access_log directive to use new format: | ||
+ | <pre> | ||
+ | access_log /var/log/nginx/yourdomain.com.access.log timed_combined; | ||
+ | </pre><ref>https://stackoverflow.com/a/39260524</ref> | ||
+ | |||
+ | :<code>request_time</code> This shows how long Nginx dealt with the request | ||
+ | :<code>upstream_response_time</code> Gives us the time it took our upstream server (in this case Apache/mod_wsgi) to respond | ||
+ | :<code>pipe</code> Shows ‘p’ in case the request was pipelined. | ||
+ | |||
+ | == See also == | ||
+ | * {{nginx}} | ||
+ | * [[Apache web server]] | ||
+ | * [[Reverse proxy]] | ||
+ | |||
+ | [[Category:Web server software]] |
Advertising: