[root@localhost ~]# vi /usr/local/nginx/conf/nginx.conf
user nobody;
worker_processes 1;
error_log logs/error.log;
pid logs/nginx.pid;
events {
use epoll;
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$req uest" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name ;
#charset koi8-r;
charset utf-8;
access_log logs/host.access.log main;
location / {
root /var/www/benet;
index index.html index.php;
}
Nginx状态访问统计
server {
listen 80;
server_name ;
#charset koi8-r;
charset utf-8;
access_log logs/host.access.log main;
location / {
root html;
index index.html index.php;
}
在server中添加如下行
location ~ /status {
stub_status on;
access_log off;
}
}
}
[root@localhost ~]# service nginx restart
[root@localhost ~]# elinks
//看到内容后按e建,在按c,选择yes退出
[root@localhost ~]# elinks
在xp上访问,要修改C:\WINDOWS\system32\drivers\etc下的host文件,右键此文件属性,将只读勾去,记事本方式打开host文件,添加如下行
192.168.1.1 添加完此行后,在网页中访问即可,否则不能访问 //