Chinaunix首页 | 论坛 | 博客
  • 博客访问: 649966
  • 博文数量: 197
  • 博客积分: 4858
  • 博客等级: 上校
  • 技术积分: 2162
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-06 22:46
文章分类

全部博文(197)

文章存档

2011年(30)

2010年(21)

2009年(25)

2008年(80)

2007年(41)

分类: BSD

2011-11-11 20:08:22

 
 
 

nginx添加参数可以允许打开目录浏览功能,详见官方的

这是说的是支持目录浏览的第三方插件fancyindex,本次试验用的nginx是freebsd 6.2默认ports安装,第三方插件下载地址:,自己可以看一下文档说明.

%cd /usr/ports/www/nginx
%make showconfig
===> The following configuration options are available for nginx-0.8.54:
     DEBUG=off "Enable nginx debugging"
     DEBUGLOG=off "Enable debug log (--with-debug)"
     FILE_AIO=off "Enable file aio"
     IPV6=off "Enable IPv6"
     GOOGLE_PERFTOOLS=off "Enable google perftools module"
     HTTP_MODULE=on "Enable HTTP module"
     HTTP_ADDITION_MODULE=off "Enable http_addition module"
     HTTP_CACHE_MODULE=on "Enable http_cache module"
     HTTP_DAV_MODULE=off "Enable http_webdav module"
     HTTP_FLV_MODULE=off "Enable http_flv module"
     HTTP_GEOIP_MODULE=off "Enable http_geoip module"
     HTTP_GZIP_STATIC_MODULE=on "Enable http_gzip_static module"
     HTTP_IMAGE_FILTER_MODULE=off "Enable http_image_filter module"
     HTTP_PERL_MODULE=off "Enable http_perl module"
     HTTP_RANDOM_INDEX_MODULE=off "Enable http_random_index module"
     HTTP_REALIP_MODULE=off "Enable http_realip module"
     HTTP_REWRITE_MODULE=on "Enable http_rewrite module"
     HTTP_SECURE_LINK_MODULE=off "Enable http_secure_link module"
     HTTP_SSL_MODULE=off "Enable http_ssl module"
     HTTP_STATUS_MODULE=on "Enable http_stub_status module"
     HTTP_SUB_MODULE=off "Enable http_sub module"
     HTTP_XSLT_MODULE=off "Enable http_xslt module"
     MAIL_MODULE=off "Enable IMAP4/POP3/SMTP proxy module"
     MAIL_IMAP_MODULE=off "Enable IMAP4 proxy module"
     MAIL_POP3_MODULE=off "Enable POP3 proxy module"
     MAIL_SMTP_MODULE=off "Enable SMTP proxy module"
     MAIL_SSL_MODULE=off "Enable mail_ssl module"
     WWW=on "Enable html sample files"
     CACHE_PURGE_MODULE=off "3rd party cache_purge module"
     ECHO_MODULE=off "3rd party echo module"
     HEADERS_MORE_MODULE=off "3rd party headers_more module"
     HTTP_ACCEPT_LANGUAGE=off "3rd party accept_language module"
     HTTP_ACCESSKEY_MODULE=off "3rd party http_accesskey module"
     HTTP_AUTH_PAM_MODULE=off "3rd party http_auth_pam module"
     HTTP_AUTH_REQ_MODULE=off "3rd party http_auth_request module"
     HTTP_EVAL_MODULE=off "3rd party eval module"
     HTTP_FANCYINDEX_MODULE=on "3rd party http_fancyindex module"
     HTTP_GUNZIP_FILTER=off "3rd party http_gunzip_filter module"
     HTTP_MOGILEFS_MODULE=off "3rd party mogilefs module"
     HTTP_MP4_H264_MODULE=off "3rd party mp4/h264 module"
     HTTP_NOTICE_MODULE=off "3rd party notice module"
     HTTP_PUSH_MODULE=off "3rd party push module"
     HTTP_REDIS_MODULE=off "3rd party http_redis module"
     HTTP_RESPONSE_MODULE=off "3rd party http_response module"
     HTTP_UPLOAD_MODULE=off "3rd party upload module"
     HTTP_UPLOAD_PROGRESS=off "3rd party uploadprogress module"
     HTTP_UPSTREAM_FAIR=off "3rd party upstream fair module"
     HTTP_UPSTREAM_HASH=off "3rd party upstream hash module"
     HTTP_UPSTREAM_KEEPALIVE=off "3rd party upstream keepalive module"
     HTTP_ZIP_MODULE=off "3rd party http_zip module"
     MEMC_MODULE=off "3rd party memc (memcached) module"
     PASSENGER_MODULE=off "3rd party passenger module"
     SLOWFS_CACHE_MODULE=off "3rd party slowfs_cache module"
     SUPERVISORD_MODULE=off "3rd party supervisord module"
     SYSLOG_SUPPORT=off "3rd party syslog support"
     UDPLOG_MODULE=off "3rd party udplog (syslog) module"
===> Use 'make config' to modify these settings

%make & make install &make clean
在安装的过程中会选择第三方插件:3rd party http_fancyindex module

这样安装完成后,就不用再下载第三方插件进行安装,即可实现我要的功能。

安装完成后,我的nginx.conf文件如下:

%grep -v # /usr/local/etc/nginx/nginx.conf

user  nobody;

worker_processes  1;

events {
    worker_connections  200;
}

http {
    include       mime.types;

    default_type  application/octet-stream;

    sendfile        on;

    keepalive_timeout  65;

    server {
        listen       8080;
        server_name  localhost;

        charset gb2312;

        location / {
            fancyindex on;
            fancyindex_exact_size off;

            root   /data/file;
            index  index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/local/www/nginx-dist;
        }

        location /systatus {
            stub_status on;
            access_log on;
            auth_basic "NginxStatus";
            auth_basic_user_file /usr/local/passwds;

        }

    }

}

这里,启用插件部分如上边红字所示,蓝色部分是关于查看nginx连接状态的配置。通过配置,发现nginx真的很人性化,很多配置很不错,修改配置也很清晰明了,更多的功能,以后有空的时候慢慢看。

本文件参考了以下两篇文章:

阅读(2811) | 评论(0) | 转发(0) |
0

上一篇:nginx对目录进行认证

下一篇:AWK简单教程

给主人留下些什么吧!~~