linux下 nginx監(jiān)控問題
nginx安裝
保證虛擬機(jī)能上網(wǎng):
1、root用戶登錄
2、查看nginx安裝信息:yum info nginx
3、如果找不到nginx信息,則執(zhí)行如下:
rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
4、再查看nginx的安裝信息
5、有咯信息,則安裝nginx命令:yum install nginx
6、查看http://192.168.1.7 如果出現(xiàn)nginx的頁面就ok咯
nginx.conf配置文件詳情
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;
}
}
}
在/etc/nginx下的nginx.conf是自定義配置文件 直接配置以上內(nèi)容
在nginx/conf.d下的默認(rèn)配置文件 不用修改
替換完后 重啟NGINX服務(wù) service nginx restart
分別開啟兩個窗口 進(jìn)行監(jiān)控
tail -f /var/log/nginx/access.log tail -f /var/log/nigx/gp1918.log
gp1918.log.log 需要自己創(chuàng)建
mkdir /data/www/web/test.jpg; 需要自己創(chuàng)建
在此目錄下 創(chuàng)建一個jpg文件 或者直接放一個圖片
在網(wǎng)頁輸入自己的 ip/test.jpg
最后看監(jiān)控

另外一個監(jiān)控是 當(dāng)你訪問ip時 才有
總結(jié)
以上所述是小編給大家介紹的linux下 nginx監(jiān)控問題,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
如果你覺得本文對你有幫助,歡迎轉(zhuǎn)載,煩請注明出處,謝謝!
相關(guān)文章
nginx用正則表達(dá)式實現(xiàn)泛域名自動匹配目錄的方法
這篇文章主要介紹了nginx用正則表達(dá)式實現(xiàn)泛域名自動匹配目錄的相關(guān)知識,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-05-05
nginx添加nginx-sticky-module模塊步驟的實現(xiàn)
nginx-sticky-module模塊是nginx實現(xiàn)負(fù)載均衡的一種方案,和ip_hash負(fù)載均衡算法會有區(qū)別的,本文主要介紹了nginx添加nginx-sticky-module模塊步驟的實現(xiàn),感興趣的可以了解一下2023-08-08

