Nginx monitoring issues under Linux

Nginx monitoring issues under Linux

nginx installation

Ensure that the virtual machine can access the Internet:

1. Log in as root user

2. Check nginx installation information: yum info nginx

3. If nginx information cannot be found, execute the following:

rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

4. Check the installation information of nginx

5. If there is information, install nginx command: yum install nginx

6. Check http://192.168.1.7. If the nginx page appears, everything is ok.

nginx.conf configuration file details

user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;

events {
  worker_connections 1024;
}

http {
  include /etc/nginx/mime.types;
  default_type application/octet-stream;
  log_format main '$remote_addr - $remote_user [$time_local] "$request" '
           '$status $body_bytes_sent "$http_referer" '
           '"$http_user_agent" "$http_x_forwarded_for"';
log_format liuhao '$remote_addr^A$msec^A$http_host^A$request_uri';
  access_log /var/log/nginx/access.log main;
  sendfile on;
  #tcp_nopush on;
  keepalive_timeout 65;
  #gzip on;
 # include /etc/nginx/conf.d/*.conf;
server {
  listen 80;
  server_name localhost;
  #access_log /var/log/nginx/host.access.log main;
location ~ .jpg {
    root /data/www/web;
    index index.html index.htm;
 access_log /var/log/nginx/gp1918.log liuhao;
  }
  location ~ / {
    root /usr/share/nginx/html;
    index index.html index.htm;
 access_log /var/log/nginx/access.log main;
  }
}
}

The nginx.conf in /etc/nginx is a custom configuration file that directly configures the above content

The default configuration file in nginx/conf.d does not need to be modified

After the replacement, restart the NGINX service service nginx restart

Open two windows for monitoring

tail -f /var/log/nginx/access.log
tail -f /var/log/nigx/gp1918.log

gp1918.log.log needs to be created by yourself

mkdir /data/www/web/test.jpg; You need to create a jpg file in this directory or put a picture directly

Enter your own ip/test.jpg on the web page

Finally, look at the monitoring

Another monitoring is when you access the IP

Summarize

The above is the nginx monitoring problem under Linux introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • How to start and restart nginx in Linux
  • Detailed explanation of solutions to common 502 errors in Nginx in Linux
  • Tutorial on installing and configuring Nginx on Linux server
  • How to install and start nginx in Linux
  • How to build nginx load balancing under Linux

<<:  Vue implements scroll loading table

>>:  Detailed tutorial on installing mysql under Linux

Recommend

About VSCode formatting JS automatically adding or removing semicolons

introduction It is okay to add or not add a semic...

W3C Tutorial (4): W3C XHTML Activities

HTML is a hybrid language used for publishing on ...

How to configure Basic Auth login authentication in Nginx

Sometimes we build a file server through nginx, w...

User needs lead to marketing-oriented design

<br />For each of our topics, the team will ...

HTML special character conversion table

character Decimal Character Number Entity Name --...

Detailed summary of mysql sql statements to create tables

mysql create table sql statement Common SQL state...

How to use Dockerfile to create a mirror of the Java runtime environment

The current environment is: Centos 7.5 docker-ce ...

How to start a transaction in MySQL

Preface This article mainly introduces how to sta...

Detailed explanation of json file writing format

Table of contents What is JSON Why this technolog...

JavaScript implements draggable modal box

This article shares the specific code of JavaScri...

JavaScript to achieve full or reverse selection effect in form

This article shares the specific code of JavaScri...