1. download source package
2. prepare install
install pcre and pcre-devel package in your system.
3. install
1) tar zxvf nginx-0.8.46.tar.gz
2) ./configure --prefix=/usr/local/nginx --with-http_stub_status_module
3) make
4) make install
4. config
1) vi /usr/local/nginx/conf/nginx.conf
user nobody nobody # run nginx user
worker_connections 1024; # connection number
location /NginxStatus {
stub_status on;
access_log on;
auth_basic "NginxStatus";
auth_basic_user_file htpasswd;
} # monitor nginx status, these line must to add into server{}.
2) htpasswd -c /usr/local/nginx/conf/htpasswd user
# you can find "htpasswd" command from apache.
5. start and test
1) run by below command
/usr/local/nginx/sbin/nginx
2) test
A) input in web broswer. you can see "welcome to nginx!"
B) input in web broswer, and input the username and password. you can see below infomation.
---------------
Active connections: 1
server accepts handled requests
3 3 3
Reading: 0 Writing: 1 Waiting: 0
-----------------
It's all.
阅读(1416) | 评论(0) | 转发(0) |