Tôi cần dừng danh sách thư mục của thư mục hình ảnh trên trang web. Tôi đang cấu hình miền cookieless cho hình ảnh và javascripts trên một trang web. Tôi đã thực hiện cấu hình CNAME và được thêm vào dưới cấu hình máy chủ ảo trong tệp httpd.conf. Tuy nhiên, nếu tôi truy cập miền cookieless này trực tiếp, nó liệt kê toàn bộ nội dung thư mục. Làm thế nào để giải quyết vấn đề này?Tùy chọn Apache -Cập hình cấu hình không hoạt động
<VirtualHost ipaddr:80> ServerAdmin [email protected] ServerName imgs.site.com ServerAlias www.imgs.site.com DocumentRoot /usr/tomcat/webapps/site/images <Directory /usr/tomcat/webapps/site/images> Options -Indexes FollowSymLinks AllowOverride none </Directory> CustomLog logs/imgs.site.com_access_log "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" ErrorLog logs/imgs.site.com_error_log </VirtualHost> <VirtualHost ipaddr:80> ServerAdmin [email protected] ServerName imgs.site.com ServerAlias www.imgs.site.com imgs.site.net DocumentRoot /usr/tomcat/webapps/site/images <Directory /usr/tomcat/webapps/site/images> Options -Indexes FollowSymLinks AllowOverride none </Directory> CustomLog logs/imgs.site.com_access_log "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" ErrorLog logs/imgs.site.com_error_log </VirtualHost>
> Tôi nghĩ rằng con đường trong Chỉ thị 'Directory' được thêm vào' DocumentRoot' << Có vẻ như tôi đã sai: "Đường dẫn thư mục" hoặc là đường dẫn đầy đủ * tới một thư mục, hoặc một chuỗi thẻ hoang dã sử dụng kết hợp kiểu vỏ Unix "(http://httpd.apache.org/docs/2.2/mod/core.html#directory). Vì vậy, ví dụ của tôi chỉ hoạt động vì nó khớp với * mọi thư mục * trong máy chủ. – hudolejev