nginx的一些配置案例

ssl站点,并且basic验证某个目录,验证成功进入后,列目录(以下例子在windows nginx 1.8.0上配置):

    server {
		listen 443 ssl;
        server_name xxxx.com;
		root C:/data/htdocs/xxxx.com;
		access_log  logs/xxxx.log;
		ssl on;
        ssl_certificate      C:/data/htdocs/ssl/xxxx/xxxx_bundle.crt;
        ssl_certificate_key  C:/data/htdocs/ssl/xxxx/xxxx.key;

        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;

        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;
	
		location ^~ /目录1/ {
			auth_basic "login:";
			auth_basic_user_file C:/data/htdocs/ssl/.htpasswd_lan;
			autoindex on;  
    		autoindex_exact_size on;  
    		autoindex_localtime on;  
			}

		location ^~ /目录2/ {
			auth_basic "login:";
			auth_basic_user_file C:/data/htdocs/ssl/.htpasswd;
			autoindex on;  
    		autoindex_exact_size on;  
    		autoindex_localtime on;  
			}
		}
上一篇
下一篇