开启Nginx的状态监控页面
第一步:编译Nginx的时候添加参数:--with-http_stub_status_module
例如:
cd nginx-0.8.15/ ./configure --user=www --group=www --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module make && make install
第二步:修改Nginx配置文件nginx.conf
vi /usr/local/webserver/nginx/conf/nginx.conf
在HTTP段中添加
server
{
listen 80;
server_name status.a18zhizao.cn;
location / { #主要是这里代表根目录显示信息
stub_status on;
access_log off;
}
}
例如:我的配置方法
server
{
listen 80;
server_name a18zhizao.cn www.a18zhizao.cn;
index index.html index.htm index.php;
root /home/wwwroot/a18zhizao;
include /usr/local/nginx/conf/myblog.conf;
location ~ .*\.(php|php5)?$
{
fastcgi_pass unix:/tmp/php-cgi.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
location /status {
stub_status on; #这里就是我的信息
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
log_format access '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
access_log /home/wwwroot/logs/access.log access;
}
最新评论