加入收藏 | 设为首页 | 会员中心 | 我要投稿 云计算网_宿迁站长网 (https://www.0527zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

CentOS 6.3安装Nginx开启目录浏览、下载功能

发布时间:2016-01-25 09:40:26 所属栏目:Linux 来源:网络整理
导读:本次实验实现目的: 安装Nginx,Nginx开启目录浏览、下载功能,开机默认启动;咐件自带开机启动脚本、重启脚本; 1、关闭SELINUX 查看获取SELinux的状态: [root

然后在ie中访问你服务器的ip,出现这个就安装成功了!

http://0.0.0.0

CentOS 6.3安装Nginx开启目录浏览、下载功能

10、查看日志

[root@localhost ~]# tail /usr/local/nginx/logs/access.log

11、开启全站所有目录浏览功能

创建目录:

[root@localhost ~]# mkdir /webshare

编辑配置文件,在http{下面添加以下内容

[root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf
http {
autoindex on; #开启nginx目录浏览功能
autoindex_exact_size off; #文件大小从KB开始显示
autoindex_localtime on; #显示文件修改时间为服务器本地时间
charset utf-8,gbk; #显示中文
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
server {
listen 80; #Nginx端口号
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
#root html;
root /webshare; #/webshare网站根目录路径
autoindex on;
index index.html index.htm;
}
:wq #保存,退出

(编辑:云计算网_宿迁站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!