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
创建
/etc/yum.repos.d/nginx.repo
文件并将修改后的配置写入.执行
yum update
更新repo.安装nginx
yum -y install nginx
Nginx 支持浏览目录
修改配置
location / {
root /data/www/file //指定实际目录绝对路径;
autoindex on; //开启目录浏览功能;
autoindex_exact_size off; //关闭详细文件大小统计,让文件大小显示MB,GB单位,默认为b;
autoindex_localtime on; //开启以服务器本地时区显示文件修改日期!
}