Linux Learning Note April 18 task

Source: Internet
Author: User
Tags create directory

11.28 restricting a directory from parsing PHP

Editing a configuration file httpd-vhosts.conf

Vim/usr/local/apache2.4/conf/extra/httpd-vhosts.conf

Add the following information

<Directory/data/wwwroot/111.com/upload>

Php_admin_flag engine off

<filesmatch (. *) \.php (. *) >

Order Allow,deny

Deny from all

</FilesMatch>

</Directory>

Reload

/usr/local/apache2.4/bin/apachectl-t

/usr/local/apache2.4/bin/apachectl Graceful

Test

mkdir upload//Create directory

LS//view file

CP 123.php upload///copy 123.php to upload directory

Curl-x127.0.0.1:80 ' Http://111.com/upload/123.php-I


11.29 Limit User_agent

<lfmodule mod_rewrite.c>

Rewriteengine on

Rewritecond%{http_user_agent}. *curl.*[nc,or]

Rewritecond%{http_user_agent}. *baidu.com.*[nc]

Rewritecond. *-[F]//f,forbidden Forbidden

<lfModule>

Reload

/usr/local/apache2.4/bin/apachectl-t

/usr/local/apache2.4/bin/apachectl Graceful

Test

Curl-x127.0.0.1:80 ' Http://111.com/upload/123.php-I

Curl-a "Aminglinux aminglinux"-X127.0.0.1:80 ' http://111.com/123.php '// -A, specify user_agent;

-I view status code;-e referer;


11.30/11.31 PHP Related Configuration

/usr/local/php/bin/php-i | Grep-i "Loaded configuration file"

Open_basedir Security Options

Php_admin_value open_basedir "/data/wwwroot/111.com:/tmp/"//Restrict a website to access the directory of this site, not to other site directories

Vim/usr/local/php7/etc/php.ini

Open_basedir =/data/wwwroot/1111.com:/tmp//if changed to 1111.com

/usr/local/apache2.4/bin/apachectl Graceful

Curl-a "A" -x127.0.0.1:80 http://111.com/2.php-I//500 error

Cat/tmp/php_errors.log//Log prompt is not in the allowed directory


Extended

Apache Open Compression http://ask.apelearn.com/question/5528

apache2.2 to 2.4 configuration file changes http://ask.apelearn.com/question/7292

Apache Options Parameter http://ask.apelearn.com/question/1051

Apache prohibits trace or track from preventing XSS http://ask.apelearn.com/question/1045

Apache configuration HTTPS support SSL http://ask.apelearn.com/question/1029


Linux Learning Note April 18 task

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.