尊龙凯时人生就是博

NginxĿ¼ä¯ÀÀÉèÖà £¬ÊµÏÖÎļþÁбíչʾ

nginxĿ¼ä¯ÀÀÉèÖà £¬ÊµÏÖÎļþÁбíչʾ

NginxÊÇÒ»¸ö¸ßÐÔÄܵÄHTTPºÍ·´ÏòÊðÀíЧÀÍÆ÷ £¬Ëü¿ÉÒÔͨ¹ý×°ÖÃĿ¼ä¯ÀÀÉèÖÃʵÏÖÎļþÁбíչʾ¡£ÔÚijЩÇéÐÎÏ £¬ÎÒÃÇ¿ÉÄÜÐèÒª½«Ä³¸öĿ¼ÖеÄÎļþÒÔÁбíµÄÐÎʽչʾ¸øÓû§ £¬ÕâÑùÓû§¿ÉÒÔÀû±ãµØä¯ÀÀ¡¢ÏÂÔØÕâЩÎļþ¡£±¾ÎĽ«ÏÈÈÝÔõÑùÉèÖÃNginxʵÏÖĿ¼ä¯ÀÀ £¬²¢Í¨¹ý´úÂëʾÀý¾ÙÐÐÑÝʾ¡£

Ê×ÏÈ £¬ÎÒÃÇÐèÒªÐÞ¸ÄNginxµÄÉèÖÃÎļþ¡£³£ÓõÄÉèÖÃÎļþΪ/etc/nginx/nginx.conf¡£·­¿ª¸ÃÎļþ £¬²¢ÕÒµ½server¶ÎµÄÉèÖÃÏî¡£ÔڸöÎÉèÖÃÏîÖÐ £¬ÎÒÃÇ¿ÉÒÔÌí¼ÓÈçÏ´úÂëÀ´ÆôÓÃĿ¼ä¯ÀÀ£º

location /path/to/directory {
    autoindex on;
    autoindex_exact_size off;
    autoindex_localtime on;
}

µÇ¼ºó¸´ÖÆ

ÔÚÉÏÊö´úÂëÖÐ £¬/path/to/directoryÊÇÐèҪչʾÎļþÁбíµÄĿ¼·¾¶ £¬Çëƾ֤ÏÖÕæÏàÐÎÐ޸ġ£¸÷¸ö²ÎÊýµÄ¼ÄÒåÈçÏ£º

autoindex on;£º¸Ã²ÎÊýÌåÏÖ¿ªÆôĿ¼ä¯ÀÀ¹¦Ð§¡£

autoindex_exact_size off;£º¸Ã²ÎÊýÌåÏÖ²»ÏÔʾÎļþ¼òÖ±ÇоÞϸ £¬¶øÊÇÒÔ¼ò»¯µÄÐÎʽչʾ¡£

autoindex_localtime on;£º¸Ã²ÎÊýÌåÏÖʹÓÃÍâµØʱ¼äÀ´Õ¹Ê¾ÎļþµÄ×îºóÐÞ¸Äʱ¼ä¡£

ÔÚÉèÖÃÍêÉÏÊö´úÂëºó £¬ÖØмÓÔØNginxµÄÉèÖÃÎļþ £¬ÏÂÁîÈçÏ£º

nginx -s reload

µÇ¼ºó¸´ÖÆ

½ÓÏÂÀ´ £¬ÎÒÃÇͨ¹ýÒ»¸öÏêϸµÄʾÀýÀ´ÑÝʾNginxĿ¼ä¯ÀÀÉèÖõÄʹÓá£

¼ÙÉèÎÒÃÇÓÐÒ»¸öÃûΪfilesµÄĿ¼ £¬¸ÃĿ¼Ï°üÀ¨ÁËһЩÎļþ¡£ÎÒÃǽ«ÔÚNginxÖÐÉèÖà £¬ÒÔ±ãÓû§Äܹ»»á¼ûµ½¸ÃĿ¼ £¬²¢Õ¹Ê¾ÎļþÁбí¡£

Ê×ÏÈ £¬½¨ÉèfilesĿ¼²¢ÔÚÆäÖа²ÅÅһЩÎļþ£º

$ mkdir files
$ touch files/file1.txt
$ touch files/file2.txt
$ touch files/file3.txt

µÇ¼ºó¸´ÖÆ

È»ºó £¬·­¿ªNginxµÄÉèÖÃÎļþ £¬²¢Ìí¼ÓÒÔÏ´úÂ룺

server {
    listen 80;
    server_name example.com;

    location /files {
        autoindex on;
        autoindex_exact_size off;
        autoindex_localtime on;
    }
}

µÇ¼ºó¸´ÖÆ

ÉúÑÄÒÔÉÏÉèÖà £¬²¢ÖØмÓÔØNginxµÄÉèÖÃÎļþ¡£

ÏÖÔÚ £¬ÎÒÃÇ·­¿ªä¯ÀÀÆ÷ £¬»á¼ûhttp://example.com/files £¬¾Í¿ÉÒÔ¿´µ½filesĿ¼ÏµÄÎļþÁбíÁË¡£ÁÐ±í½«Õ¹Ê¾ÎļþÃû³Æ¡¢×îºóÐÞ¸Äʱ¼äµÈÐÅÏ¢ £¬ÈçÏÂËùʾ£º

Index of /files

[ICO] Name    Last modified    Size    Description
============================================================================
[PARENTDIR] Parent Directory        -    
[file1.txt]   2021-01-01 00:00      -     
[file2.txt]   2021-01-02 00:00      -     
[file3.txt]   2021-01-03 00:00      -

µÇ¼ºó¸´ÖÆ

ͨ¹ýÒÔÉÏÉèÖà £¬ÎÒÃÇÒѾ­ÀÖ³ÉʵÏÖÁËNginxĿ¼ä¯ÀÀÉèÖà £¬ÊµÏÖÁËÎļþÁбíµÄչʾ¡£

×ܽ᣺

±¾ÎÄÏÈÈÝÁËÔõÑùͨ¹ýÐÞ¸ÄNginxµÄÉèÖÃÎļþ £¬ÊµÏÖĿ¼ä¯ÀÀ²¢Õ¹Ê¾ÎļþÁбí¡£Í¨¹ýÔÚlocation¶ÎÖÐÌí¼ÓÏà¹ØÉèÖòÎÊý £¬¿ÉÒÔ¿ªÆôĿ¼ä¯ÀÀ¹¦Ð§ £¬²¢×Ô½çËÃ÷ÈչʾµÄÎļþÐÅÏ¢¡£Óû§¿ÉÒÔƾ֤ÏÖʵÐèÇóÀ´ÉèÖÃNginx £¬ÊµÏÖÔ½·¢¸öÐÔ»¯µÄÎļþÁбíչʾЧ¹û¡£½Ó´ý¸÷ÈËʵÑ鲢ʩչ´´Òâ £¬´òÔì¸üºÃµÄÓû§ÌåÑ飡

ÒÔÉϾÍÊÇNginxĿ¼ä¯ÀÀÉèÖà £¬ÊµÏÖÎļþÁбíչʾµÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是博ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是博ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是博

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ