swanwish / blog

My blog website
0 stars 0 forks source link

Output domain name on nginx log #57

Open swanwish opened 5 years ago

swanwish commented 5 years ago

The default setting on nginx log format doesn't have domain name, add the $host on the log format, it will output the domain name on the log file, the setting on /etc/nginx/nginx.conf file is like below:

    log_format  main  '$remote_addr - $remote_user [$time_local] "$host" "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';