简体   繁体   中英

prevent php files from being downloaded in apache or Windows Server 2008

  1. In Linux Apache, I put my php files under /var/www/html. If I don't add an index.html in every subfolders under /var/www/html, Then my php files will be listed and can be downloaded.

The question is must I configure the apache file in order to prevent listing of my php files and hence to prevent download of my php files ?

[Edited] I want the php file to be executed and produce desired web pages but the sourcecode files not to be downloaded by anyone. My php files are placed under /var/www/html in a Ubuntu On AWS EC2. Then I try to do something like: type awsec2ip/mywebsiteRootDirectory/ , if there ain't an index.html, then the server lists my php files and allow me to right-click the php files and then download them.

[not so related to question 1]Also I want to ask if I only want my android application to run some php files for dealing with the database, where should I put the php files or how should I configure the apache?

Thanks for your help and sorry for my inexperience

  1. Similarly in Windows Server 2008, what are the proper procedures to produce the same security effect?

将其添加到您的Web根文件夹/var/www/html .htaccess文件中:

Options -Indexes

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