nginx安裝
保證虛擬機能上網:
1、root用戶登錄
2、查看nginx安裝信息:yum info nginx
3、如果找不到nginx信息,則執行如下:
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 如果出現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是自定義配置文件 直接配置以上內容
在nginx/conf.d下的默認配置文件 不用修改
替換完后 重啟NGINX服務 service nginx restart
分別開啟兩個窗口 進行監控
tail -f /var/log/nginx/access.log
tail -f /var/log/nigx/gp1918.log
gp1918.log.log 需要自己創建
mkdir /data/www/web/test.jpg;
需要自己創建
在此目錄下 創建一個jpg文件 或者直接放一個圖片
在網頁輸入自己的 ip/test.jpg
最后看監控

另外一個監控是 當你訪問ip時 才有
總結
以上所述是小編給大家介紹的linux下 nginx監控問題,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對腳本之家網站的支持!
如果你覺得本文對你有幫助,歡迎轉載,煩請注明出處,謝謝!