Restricting site directories in nginx+php to prevent cross-site configuration scenario Logging

Source: Internet
Author: User
Tags fpm

Restricting the site directory in nginx+php prevents cross-site configuration scenario logging (using Open_basedir)-------------------
Method 1) In the Nginx configuration file, add:

1 fastcgi_param  PHP_VALUE  "open_basedir=$document_root:/tmp/:/proc/";

Usually nginx site configuration file with include fastcgi.conf, so, add this line in the fastcgi.conf is OK.
If a site needs to set up additional directories separately, write the above code in the include Fastcgi.conf, and the line below will be OK, overwriting the settings in the fastcgi.conf.
This mode of Setup requires the restart of Nginx to take effect.

Method 2) Add in the php.ini

1234 [HOST=www.wangshibo.com]open_basedir=/home/www/www.wangshibo.com:/tmp/:/proc/[PATH=/home/www/www.wangshibo.com]open_basedir=/home/www/www.wangshibo.com:/tmp/:/proc/

This mode of Setup requires a restart of php-fpm after it takes effect.

Method 3) Create the. user.ini file in the root directory of the Web site and write the following information in the file:

1 open_basedir=/home/www/www.wangshibo.com:/tmp/:/proc/

There is no need to restart the Nginx or PHP-FPM service in this way. For security reasons, you should cancel the Write permission for the. user.ini file.

The following functions are recommended in php.ini:

1 disable_functions = pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_w
Gmt
Detect languageAfrikaansAlbanianArabicArmenianAzerbaijaniBasqueBelarusianBengaliBosnianBulgarianCatalanCebuanoChichewaChinese (Simplified)Chinese (Traditional)CroatianCzechDanishDutch中文版EsperantoEstonianFilipinoFinnishFrenchGalicianGeorgianGermanGreekGujaratiHaitian CreoleHausaHebrewHindiHmongHungarianIcelandicIgboIndonesianIrishItalianJapaneseJavaneseKannadaKazakhKhmerKoreanLaoLatinLatvianLithuanianMacedonianMalagasyMalayMalayalamMalteseMaoriMarathiMongolianMyanmar (Burmese)NepaliNorwegianPersianPolishPortuguesePunjabiRomanianRussianSerbianSesothoSinhalaSlovakSlovenianSomaliSpanishSundaneseSwahiliSwedishTajikTamilTeluguThaiTurkishUkrainianUrduUzbekVietnameseWelshYiddishYorubaZulu AfrikaansAlbanianArabicArmenianAzerbaijaniBasqueBelarusianBengaliBosnianBulgarianCatalanCebuanoChichewaChinese (Simplified)Chinese (Traditional)CroatianCzechDanishDutch中文版EsperantoEstonianFilipinoFinnishFrenchGalicianGeorgianGermanGreekGujaratiHaitian CreoleHausaHebrewHindiHmongHungarianIcelandicIgboIndonesianIrishItalianJapaneseJavaneseKannadaKazakhKhmerKoreanLaoLatinLatvianLithuanianMacedonianMalagasyMalayMalayalamMalteseMaoriMarathiMongolianMyanmar (Burmese)NepaliNorwegianPersianPolishPortuguesePunjabiRomanianRussianSerbianSesothoSinhalaSlovakSlovenianSomaliSpanishSundaneseSwahiliSwedishTajikTamilTeluguThaiTurkishUkrainianUrduUzbekVietnameseWelshYiddishYorubaZulu
Text-to-Speech function is limited to characters
Options:History:Feedback:Donate Close

Restricting site directories in nginx+php to prevent cross-site configuration scenario Logging

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.