Apache: disable the Indexes option with Options -Indexes in the most specific applicable <Directory>, virtual-host, or .htaccess context. If another directive inherited Indexes, remove that keyword while keeping the other options you need.
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
Nginx: put autoindex off; in the applicable http, server, or location block. Nginx documents off as the default, but a more-specific block can still turn listings on. After either change, validate the configuration, reload the service, and request a directory that has no index file.
As an Amazon Associate I earn from qualifying purchases.
What a directory listing is and why it appears
When a browser requests a directory URL such as /assets/, the web server normally looks for an index file. Common examples are index.html, an application front controller, or another filename configured for that site. If no configured index exists, the server has two choices: return an error, or generate a page showing the directory’s files. That generated page is the directory listing often labelled “Index of” in Apache or rendered as an autoindex page in Nginx.
A listing is not the same as a file being publicly reachable. Turning off the listing stops the server from generating a catalogue, but a person who already knows a file’s URL may still retrieve it if routing and file permissions allow access. Use authentication, authorization rules, private storage, or application-level controls when the files themselves must be protected.
#1 Best Overall
- BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
- EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
- COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
- LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
- WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
Listings can disclose filenames, backup archives, upload directories, source maps, logs, and the layout of a site. Removing that accidental inventory is a sensible hardening step, especially for directories that contain deployment artifacts or user uploads. It does not, however, repair incorrect permissions or remove files that should never be web-accessible.
Quick reference: the setting to change
| Server | Directive that controls generated listings | Where it can be set | What to use to disable it | Component involved |
|---|---|---|---|---|
| Apache HTTP Server | Indexes in an Options directive |
<Directory>, virtual-host configuration, or per-directory .htaccess; inherited options also matter |
Options -Indexes, or remove Indexes from an existing Options line |
mod_autoindex |
| Nginx | autoindex |
http, server, or location block |
autoindex off; |
ngx_http_autoindex_module |
Apache’s automatic index generation is enabled with Options +Indexes; its disabling form is Options -Indexes. Nginx’s syntax is autoindex on | off;, and its documented default is off. In both servers, the setting only has an effect in the configuration context that actually handles the request.
Recommended Free Tools
Disable directory listing on Apache
1. Find the configuration that serves the directory
Start by identifying the virtual host and filesystem directory that answer the URL. The setting might be in the active virtual-host file, a broader or narrower <Directory> section, or a per-directory .htaccess file. It can also be inherited from a parent configuration where Indexes was enabled.
Do not edit an example file or an inactive virtual host and assume the change applies. Compare the requested hostname and path with the virtual host’s ServerName, aliases, document root, and directory mappings. For a subdirectory, inspect both the document-root rule and any nested <Directory> or .htaccess rules.
2. Remove or negate the Indexes option
If the applicable configuration contains an enabling line such as:
Options +Indexes
replace it with:
Options -Indexes
If the line enables several options, preserve the others and remove only the listing keyword. For example:
Rank #2
- WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
- AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
- PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
- ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
- COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
Options Indexes FollowSymLinks
can become:
Options -Indexes FollowSymLinks
The important part is that the effective options for this directory do not include Indexes. Apache’s FAQ describes the same operation as removing the Indexes keyword from the appropriate Options line.
3. Put the directive in the most specific applicable section
Apache combines configuration from several scopes, and a more-specific section can override a broader setting. A server-wide or parent-directory change may therefore appear to do nothing if a nested rule enables Indexes again. Place the negation in the directory section that maps to the requested path, or in that directory’s allowed .htaccess.
A virtual-host example looks like this (replace the filesystem path with the real document root):
<VirtualHost *:80>
ServerName example.test
DocumentRoot /var/www/example
<Directory /var/www/example>
Options -Indexes
DirectoryIndex index.html
Require all granted
</Directory>
</VirtualHost>
The DirectoryIndex line is separate from the listing control. Keep an appropriate index file or application entry point so that a normal directory URL still reaches the intended site.
Free tools Windows power users keep installed
One-click scans. No signup required.
4. Check the index-file behavior
Apache first looks for a matching DirectoryIndex. When none is found, the Indexes option allows mod_autoindex to return a formatted listing. Disabling Indexes prevents that fallback; it does not create an index file. A directory without an index may consequently return a forbidden or not-found response, depending on the rest of the site’s access rules.
If the directory should show an application page, confirm that its configured index name exists and that the relevant handler can execute it. If it should never be browsable, leaving it without an index while disabling listings is often appropriate, but test the status code expected by your application.
Rank #3
- Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
- Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
- Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
- ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
- Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
5. If using .htaccess, confirm that overrides are permitted
Per-directory configuration works only when the server administrator allows the required class of overrides for that path. If Apache returns a server error after adding Options -Indexes, the directory may disallow Options directives in .htaccess. Move the rule into the virtual-host or main configuration, or adjust the directory’s override policy deliberately. Do not hide a syntax or permission problem by deleting the directive and leaving listings enabled.
A minimal per-directory file is:
Options -Indexes
Ensure that a parent .htaccess, an included configuration file, or an application deployment step does not later add Options +Indexes or Options Indexes.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →6. Validate, reload, and test Apache
Use the service’s normal configuration test before reloading. On installations that provide the standard Apache utility, a typical check is:
apachectl configtest
Proceed only when the result reports a valid configuration. Reload Apache through your operating system or process manager so workers receive the change; a restart is not normally required solely for this setting. The exact service command varies by distribution and deployment method, so use the procedure used for that installation.
For verification, create or choose a directory that has no configured index file, request its trailing-slash URL, and inspect the response. A generated “Index of” page should no longer be returned. If the application expects a directory index, also request a directory that does contain its normal entry file and confirm that it still loads.
Apache troubleshooting
- The listing remains: search the active virtual-host and included configuration for another
Options IndexesorOptions +Indexes. Check nested<Directory>sections and per-directory files, then putOptions -Indexesin the most specific applicable context. - The rule causes a configuration error: check the spelling and placement of
Options -Indexes, and verify that the directory permits the necessary.htaccessoverride. A syntax test should identify the file and line. - The site now returns an error for a directory: disabling a listing does not supply an index. Verify
DirectoryIndex, the physical index file, filesystem permissions, and any application rewrite rules. - Only one subdirectory behaves differently: inspect that directory for its own
.htaccessor a more-specific configuration block. Apache’s specificity rules can make a parent setting ineffective there. - Files are still downloadable: that is expected. Listing suppression hides the generated catalogue; it does not deny direct requests. Add access control or move sensitive files outside the web root.
Disable directory listing on Nginx
1. Identify the active server and location
Open the configuration used by the hostname and locate the location that serves the static directory. Check included files as well as the main file; many deployments assemble a server block from fragments. Confirm the request’s path, the root or alias mapping, and whether a regular-expression location takes precedence over the prefix location you edited.
Rank #4
- Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
- Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
- 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
- Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
- USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
Nginx permits autoindex in http, server, and location contexts. A broad setting can establish a default, while a more-specific location can override it. For a single directory, the location serving that directory is usually the clearest place to make the rule explicit.
2. Set autoindex off;
Add the directive to the applicable block:
server {
listen 80;
server_name example.test;
root /var/www/example;
location /assets/ {
autoindex off;
}
}
If a parent block contains autoindex on;, an explicit autoindex off; in the selected location prevents that location from generating a listing. Remove an unnecessary enabling directive where possible, but retain the explicit setting when it documents the intended behavior for a sensitive path.
Nginx’s documented default is already off. Seeing a listing therefore usually means an included configuration, a parent block, or a more-specific location has enabled it, or that a different server block is handling the request.
3. Confirm the index directive and entry file
Nginx processes a directory request using its index handling. The autoindex module is used for slash-terminated requests when the index module cannot find an index file. Keep the expected file and index directive if the directory should open an application page:
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteserver {
root /var/www/example;
index index.html index.htm;
location / {
autoindex off;
}
}
Do not add an index file merely to conceal an unintended configuration error. Decide whether the path should serve a real entry point or fail without exposing its contents, then configure and test that intended result.
4. Watch location precedence
Nginx does not simply apply the visually nearest line in a file. Its location-selection rules determine which block handles a URI, and the chosen block’s configuration can differ from the one you edited. A regular-expression location, an exact match, or a nested location may serve the request instead of a general prefix block.
Best Value
- Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
- Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
- Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
- Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
- Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
When a listing persists, trace the request to the winning location and inspect every included file for autoindex on;. Put autoindex off; in that winning context or remove the enabling setting at its source.
5. Validate, reload, and test Nginx
Run Nginx’s configuration test before applying a reload:
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minutenginx -t
The command should report valid syntax and a successful configuration test. Reload Nginx using the service manager, container supervisor, or deployment process that owns the running workers. A reload applies the new configuration without requiring a full stop, provided the test succeeds.
Request a directory that deliberately lacks its configured index file and has a trailing slash. Confirm that Nginx does not return an automatically generated file list. Then test a normal directory containing the site’s index file, plus a known static file, to ensure the change did not break intended delivery.
Nginx troubleshooting
- A listing still appears: check the actual server block selected for the hostname, all included files, and more-specific locations. Look specifically for
autoindex on;. - The configuration test fails: inspect the reported file and line for a missing semicolon, a misplaced directive, or an edit in a file not included by the running configuration. Correct the syntax before reloading.
- The directory now returns an error: verify the
indexdirective, the physical index file, therootoraliaspath, and filesystem access. Turning off autoindex does not create a fallback page. - Only one URI shows a listing: determine which location wins for that URI and place
autoindex off;there. A broad setting inhttporserverdoes not guarantee the result when a nested location enables the feature. - Known files remain reachable: this is normal. Use access controls, deny rules, authentication, or storage outside the public root when direct access must be blocked.
Apache and Nginx: the practical differences
| Question | Apache HTTP Server | Nginx |
|---|---|---|
| Primary switch | Options -Indexes, or remove Indexes from an existing Options directive |
autoindex off; |
| Listing module | mod_autoindex |
ngx_http_autoindex_module |
| Contexts to inspect | <Directory>, virtual host, .htaccess, and inherited Options |
http, server, and location |
| What happens when no index exists | DirectoryIndex is tried; with Indexes enabled, mod_autoindex can generate a listing |
Index processing is tried; with autoindex enabled, the autoindex module can generate a listing for a slash-terminated request |
| Common reason a change appears ineffective | A more-specific Options directive or nested .htaccess still enables Indexes |
A more-specific or differently selected location still enables autoindex, or another server block handles the request |
| Documented default | Depends on the effective Options configuration |
autoindex off |
The syntax differs, but the diagnostic method is the same: identify the handler, find the most specific active configuration, disable the listing switch there, preserve the intended index behavior, validate, reload, and test a directory with no index file.
A safe verification checklist
- Choose a controlled test path. Use a directory with no matching index file, or create a temporary test directory outside production content.
- Request the canonical directory URL. Include the trailing slash so the server’s directory and index processing is exercised rather than a redirect or application route.
- Confirm the generated page is gone. The response must not contain the server’s automatic file list. Record the status code your application intends to return when no index exists.
- Test a valid index. Request a directory that contains its normal entry file and verify that it still serves the site or application.
- Test a known static file. Listing suppression should not break an asset that is intentionally public.
- Check direct access separately. Requesting a guessed filename may still succeed; decide whether that is acceptable and apply authorization or deny rules if it is not.
- Recheck after deployment. Configuration generators, container images, and control panels can overwrite hand-edited files. Keep the setting in the source configuration that is actually deployed.
What disabling listings does—and does not—secure
It prevents an automatic index page from advertising the names and paths of files in a directory. That reduces casual discovery and removes one common information leak. It does not encrypt files, authenticate users, sanitize uploads, stop directory traversal vulnerabilities, or override an application route that deliberately serves a file.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →For sensitive material, use layered controls: store it outside the public document root when possible; require authentication and authorization; restrict filesystem permissions; block backup and temporary extensions; and review logs for unexpected requests. Treat Options -Indexes and autoindex off; as exposure-reduction settings, not as a substitute for access control.
Quick Recap
Deployment checklist
- Identify the exact hostname, URL path, and filesystem directory involved.
- Find the active Apache
<Directory>, virtual-host, or.htaccesscontext, or the active Nginxserver/locationcontext. - Remove Apache’s
Indexeskeyword or setOptions -Indexes. - Set Nginx’s
autoindex off;and check for more-specificautoindex on;directives. - Keep or correct the intended
DirectoryIndexor Nginxindexfile. - Run
apachectl configtestornginx -tbefore reloading. - Reload through the process manager that owns the service.
- Request an index-less directory and verify that no generated listing is returned.
- Test normal index pages, public files, and direct access to anything that must remain private.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




