Nginx app access logs
An app’s Nginx access log contains records of every request for that app received by Nginx along with information about the response sent by Nginx.
As Nginx proxies all requests to Apache, the status code in each log entry will be the status code of the response received from Apache. Learn more about request handling.
View the logs
An app’s Nginx access logs can be viewed from within the ServerPilot dashboard or through SSH.
Log file location
There are two Nginx access log files for an app:
- HTTP request log — An access log for requests received over HTTP. All apps have this log file.
- HTTPS request log — An access log for requests received over HTTPS. Apps with SSL enabled have this log file.
Relative to the home directory of the app’s system user, the paths to an app’s Nginx access logs are:
log/APPNAME/APPNAME_nginx.access.log
log/APPNAME/APPNAME_nginx.access_ssl.log
where APPNAME
is the name of the app.
Log file format
The format of each log entry is:
IP_ADDRESS - AUTH_USER [DATE_TIME] "REQUEST_METHOD REQUEST_URI HTTP_VERSION" RESPONSE_CODE CONTENT_LENGTH "HTTP_REFERER" "USER_AGENT" "X_FORWARDED_FOR" REQUEST_LENGTH REQUEST_SECONDS "UPSTREAM_CONTENT_LENGTH" "UPSTREAM_REQUEST_SECONDS" "REQUEST_HOST"
For example:
66.249.79.36 - - [07/Mar/2025:00:03:34 +0000] "GET /blog HTTP/1.1" 302 1395 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" "-" 340 0.125 "1395" "0.125" "example.com"
The fields in each log entry are described in the following table.
Field | Description |
---|---|
IP_ADDRESS | IP address of the client that made the request. |
AUTH_USER | User name from the Authorization: Basic ... header or - if not present. |
DATE_TIME | Date and time the request was received. |
REQUEST_METHOD | Request method such as GET or POST . |
REQUEST_URI | Request path and query string. |
HTTP_VERSION | HTTP version used for the request. |
RESPONSE_CODE | Status code of the response such as 200 or 404 . |
CONTENT_LENGTH | Size in bytes of the response sent by Nginx. |
HTTP_REFERER | Value of the Referer request header or - if not present. |
USER_AGENT | Value of the User-Agent request header or - if not present. |
X_FORWARDED_FOR | Value of the X-Forwarded-For request header or - if not present. |
REQUEST_LENGTH | Size in bytes of the request including the request line and headers. |
REQUEST_SECONDS | Seconds elapsed between when the first request bytes were read from the client and when the last response bytes were sent to the client. |
UPSTREAM_CONTENT_LENGTH | Size in bytes of the response received from Apache. |
UPSTREAM_REQUEST_SECONDS | Seconds elapsed waiting for and receiving the response from Apache. |
REQUEST_HOST | Host name from the Host request header or, if present, the host name from the request line. |
Example commands
View recent Nginx access log entries
Show the most recent 100 lines in an app’s Nginx access log for HTTP requests.
tail -n 100 log/APPNAME/APPNAME_nginx.access.log
Show the most recent 100 lines in an app’s Nginx access log for HTTPS requests.
tail -n 100 log/APPNAME/APPNAME_nginx.access_ssl.log