Skip to content

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:

Access log for HTTP requests
log/APPNAME/APPNAME_nginx.access.log
Access log for HTTPS requests
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.

FieldDescription
IP_ADDRESSIP address of the client that made the request.
AUTH_USERUser name from the Authorization: Basic ... header or - if not present.
DATE_TIMEDate and time the request was received.
REQUEST_METHODRequest method such as GET or POST.
REQUEST_URIRequest path and query string.
HTTP_VERSIONHTTP version used for the request.
RESPONSE_CODEStatus code of the response such as 200 or 404.
CONTENT_LENGTHSize in bytes of the response sent by Nginx.
HTTP_REFERERValue of the Referer request header or - if not present.
USER_AGENTValue of the User-Agent request header or - if not present.
X_FORWARDED_FORValue of the X-Forwarded-For request header or - if not present.
REQUEST_LENGTHSize in bytes of the request including the request line and headers.
REQUEST_SECONDSSeconds 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_LENGTHSize in bytes of the response received from Apache.
UPSTREAM_REQUEST_SECONDSSeconds elapsed waiting for and receiving the response from Apache.
REQUEST_HOSTHost 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.

Terminal window
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.

Terminal window
tail -n 100 log/APPNAME/APPNAME_nginx.access_ssl.log