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

Vue+ElementUI implements paging function-mysql data

Table of contents 1. Problem 2. Solution 2.1 Pagi...

Detailed introduction to CSS priority knowledge

Before talking about CSS priority, we need to und...

This article will help you understand the life cycle in Vue

Table of contents 1. beforeCreate & created 2...

TypeScript decorator definition

Table of contents 1. Concept 1.1 Definition 1.2 D...

Example of how to install nginx to a specified directory

Due to company requirements, two nginx servers in...

Use CSS content attr to achieve mouse hover prompt (tooltip) effect

Why do we achieve this effect? ​​In fact, this ef...

The difference between MySQL database host 127.0.0.1 and localhost

Many of my friends may encounter a problem and do...

Detailed explanation of common usage of MySQL query conditions

This article uses examples to illustrate the comm...

A brief discussion on mysql backup and restore for a single table

A. Installation of MySQL backup tool xtrabackup 1...

Does the % in the newly created MySQL user include localhost?

Normal explanation % means any client can connect...

Example code for implementing WeChat account splitting with Nodejs

The company's business scenario requires the ...

Detailed explanation of CSS animation attribute keyframes

How long has it been since I updated my column? H...

Detailed explanation of prototypes and prototype chains in JavaScript

Table of contents Prototype chain diagram Essenti...