nginx安装

官网


https://nginx.org/


在这里插入图片描述

yum安装


https://nginx.org/en/linux_packages.html#RHEL


To set up the yum repository, create the file named /etc/yum.repos.d/nginx.repo with the following contents:


[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

To install nginx, run the following command:

sudo yum install nginx

模块使用方法:

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

ngx_http_autoindex_module模块学习


作用:


The ngx_http_autoindex_module module processes requests ending with the slash character (‘/’) and produces a directory listing. Usually a request is passed to the ngx_http_autoindex_module module when the ngx_http_index_module module cannot find an index file.


配置:


the ngx_http_index_module module cannot find an index file
request is passed to the ngx_http_autoindex_module module

server {
    listen       80;
    server_name  blog.ljbb.com;
    location / {
        autoindex on;
        root   /html/blog;
    }
}

ngx_http_access_module模块学习


作用:


The ngx_http_access_module module allows limiting access to certain client addresses.


配置:


location / {
    deny  192.168.1.1;
    allow 192.168.1.0/24;
    allow 10.1.1.0/16;
    allow 2001:0db8::/32;
    deny  all;
}

ngx_http_auth_basic_module模块学习


作用:


The ngx_http_auth_basic_module module allows limiting access to resources by validating the user name and password using the “HTTP Basic Authentication” protocol.


配置:


location / {
    auth_basic           "closed site";
    auth_basic_user_file conf/htpasswd;
}

ngx_http_index_module模块学习


作用:


The ngx_http_index_module module processes requests ending with the slash character (‘/’). Such requests can also be processed by the ngx_http_autoindex_module and ngx_http_random_index_module modules.


配置:


location / {
    index index.$geo.html index.html;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值