Nginx 使用笔记

Linux 安装 nginx

Centos 6
nginx 官方网站: http://nginx.org
查看详细的安装方式: http://nginx.org/en/linux_packages.html#stable

官方配置

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1

修改后

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
gpgcheck=0
enabled=1
  1. 创建 /etc/yum.repos.d/nginx.repo 文件并将修改后的配置写入.

  2. 执行 yum update 更新repo.

  3. 安装nginx yum -y install nginx

Nginx 支持浏览目录

修改配置

location / {   
        root /data/www/file         //指定实际目录绝对路径;   
        autoindex on;               //开启目录浏览功能;   
        autoindex_exact_size off;   //关闭详细文件大小统计,让文件大小显示MB,GB单位,默认为b;   
        autoindex_localtime on;     //开启以服务器本地时区显示文件修改日期!   
}  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值