nginx常用模块
发布日期:2021-05-09 07:04:52 浏览次数:15 分类:博客文章

本文共 6859 字,大约阅读时间需要 22 分钟。

[root@web01 ~]# nginx -V	#������nginx���������������������������������������������������������syntax		:������default		:������context		:������location	���������autoindex	:������������#���������������������������������������nginx������������server���������������/ ���������������������������������/centos/7/os/x86_64/Packages/[root@web01 /dir]# mkdir /dir/centos/7/os/x86_64/Packages/ -p#������nginx���������������������������������������������������������������������[root@web01 ~]# nginx -V 2>1.txt[root@web01 ~]# grep autoindex 1.txtautoindex���index������������������������������������������������������������403������nginx���������������������������index���������������������������autoindex���������������autoindex������������������������������������������������index.html������index.htm������������������������index.html������index.htm,���������������html������IP������nginx������������/usr/share/nginx/html/index.html������������������IP���index.html���������������html������������������������������������������������������������������������������������������������html������������default.conf������nginx������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mv 1.txt{,.conf}cp 1.txt{,.bak}cp *.txt{,.conf}cp *{,.conf}���������������������������������������������������������������������������������������������������index,autoindex,size,locatimeindex ���������������http���,server������location���������������������location���wget ���������������������������������������������������������������������������������������������������������������gbk���windows������������charset utf-8,gbk;nginx������������������������������������������������������������������������ '������'

autoindex���������autoindex������

������������

1.������nginx���������������#������������vim /etc/nginx/conf.d/auto_index.html server {        listen 80;        server_name www.abc.com;        location / {                root /dir;                autoindex on;        }}2.������������������ping www.abc.com������������������������hosts������������������������3.������������������mkdir /dir4.���������������������������������������������echo ������ > /dir/base/1.cssvim /etc/nginx/mime.types	#������nginx������������������������������������������

autoindex_exact_size������

on :������������������������������������������������������������������������������������������������������������������

off :������������������������������������b/kb/mb���������������������������������

���������������������������������?

vim /etc/nginx/conf.d/auto_index.html server {        listen 80;        server_name www.abc.com;        location / {        charset utf-8,gbk;        autoindex_exact_size off;                root /dir;                autoindex on;        }}

autoindex_localtime on ������

���������������������������on������������������-11���������������������������������������off���������������������������������������������������

vim /etc/nginx/conf.d/auto_index.confserver {        listen 80;        server_name www.abc.com;        location / {                charset utf-8,gbk;                autoindex_exact_size off;                autoindex_localtime on;                root /dir;                autoindex on;        }}

index������(������������)

vim /etc/nginx/conf.d/auto_index.html 	#���������������������server {        listen 80;        server_name www.abc.com;        location / {                root /dir;                autoindex on;                index index.html;        }}#������HTML������������������������������vim index.html    
���������

������

������ ���������������������������������������������������������������������������������������HTML������

������ngx_http_stub_status_module������

���������������������������������������������������������������������������������������������

������alias���������������������������location������������������������������������������������������������������������������location������������������������

������root������������������������������������������������������������������ ������������ ������

location = /basic_status ������location���������������������location���������������������������

���������������������������������������������������������������������������������������

1.������status������vim /etc/nginx/conf.d/syy1.conf server {        listen 80;        server_name www.syy1.com;        location / {                root /code/syy1;                index index.html;        }        location /o {        alias /code;        autoindex on;        }        location = /basic_status {            stub_status;		}}2.��������������� http://www.syy1.com/basic_statusActive connections: 2 server accepts handled requests 196 196 283 Reading: 0 Writing: 1 Waiting: 1 ���������������2���������  ������  ������  ������        196  196   283���������������0���������������1���������������1#���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#������������������������������������������������������������������������������������������������vim /etc/nginx/nginx.conf #������������������������    keepalive_timeout  0;    [root@web01 ~]# curl http://www.syy1.com/basic_statusActive connections: 1 server accepts handled requests 282 282 461 Reading: 0 Writing: 1 Waiting: 0[root@web01 ~]# curl -s http://www.syy1.com/basic_status|awk 'NR==3{print $3}'463curl ������������������������

ngx_http_auth_basic_module������

1.������server������vim /etc/nginx/conf.d/syy1.conf server {        listen 80;        server_name www.syy1.com;        location / {                root /code/syy1;                index index.html;                auth_basic           "aaa";                auth_basic_user_file /code/htpasswd;        }}2.������������������3.������������������4.������index.html���������������������������5.��������������������������� ���������������������������������������������������������������������[root@web01 /code]# htpasswd -b -c htpasswd syy 1Adding password for user syy[root@web01 /code]# cat htpasswd syy:$apr1$Syj2XZuM$Hzijmo/8HkJdKJiROOiX/06.���������������������������������������������
#���������������������������������������������������������������������IP������������������������������������������������vim /etc/nginx/conf.d/syy1.conf +17server {        listen 80;        server_name www.syy1.com;        location / {                root /code/syy1;                index index.html;                auth_basic           "aaa";                auth_basic_user_file /code/htpasswd;        }        location /status {        stub_status;        allow 10.0.0.0/24;        deny all;}}
上一篇:ngin 模块及模板
下一篇:HTML

发表评论

最新留言

做的很好,不错不错
[***.243.131.199]2025年04月25日 10时53分12秒