开发者社区> 问答> 正文

nginx如何开启目录浏览

各位大大、聚聚好
     百度和bing了半天,发现各教程给的都不能开启,不知道是不是我的配置有问题:
这是我网站的配置,我想让wordpress目录下的download目录可以开启目录浏览。



server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /var/www/wordpress/;

    index index.php index.html index.htm ;
    
    server_name localhost;    


    if (-f $request_filename/index.html){
                rewrite (.*) $1/index.html break;
        }
    if (-f $request_filename/index.php){
                rewrite (.*) $1/index.php;
        }
    if (!-f $request_filename){
                rewrite (.*) /index.php;
        }

    location / {
            try_files $uri $uri/ =404;
        }

    location /download {
         autoindex on;
         }

    error_page 404 /404.html;

    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    }


    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

展开
收起
map 2014-11-30 13:14:55 6503 0
1 条回答
写回答
取消 提交回答
  • Renginx如何开启目录浏览
    2014-11-30 19:08:25
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
《Nginx 代理系统常用手册》 立即下载
CentOS Nginx PHP JAVA 多语言镜像使用手 立即下载
CentOS Nginx PHP JAVA多语言镜像使用手册 立即下载