简体   繁体   中英

How to prevent directory listing on AWS Elastic Beanstalk?

How do I prevent directory listing on AWS Elastic Beanstalk? I am running a Linux/PHP application, and I use the web interface to upload and configure it.

Elastic Beanstalk for PHP is a standard Apache server. It will read any .htaccess file that you add to the application.

You can create a .htaccess file in the root of your application that contains:

Options -Indexes

This is the easiest way to disable index browsing in Elastic Beanstalk. If you want to get fancy you can use the .ebextensions folder, see Customizing and Configuring AWS Elastic Beanstalk Environments for details (it is more for adding remote files, and making configuration changes to the server itself).

I'm not quite sure you can add a configuration file (such as .htaccess) to AWS Elastic Beanstalk. Ofcoure, you can always put an empty file (for example) named index.html in every folder. If someone tries to access this folder he'll reach this page instead of the list.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM