LNMP Troubleshoot access denied error details _nginx

Source: Internet
Author: User
Tags fpm php error file permissions

After handling the LNMP environment, the access denied error is rendered

Set up a good LNMP environment, rendering access denied error, now removed the file permissions of the problem is also swept away is nginx problem, but can not parse the problem of PHP.

Found that many of the online Daniel are nginx log to troubleshoot, but turned nginx.conf found that my log information is not meticulous, so I hope to configure the Log_format

Configure the Nginx Log_format

① Open nginx.conf
② the original Log_format line, use the following local exchange

Log_format Main ' $remote _addr-$remote _user [$time _local] '
' fwf[$http _x_forwarded_for] tip[$http _true_client_ip] '
' $upstream _addr $upstream _response_time $request _time '
' $geoip _country_code '
' $http _host $request '
"$status" $body _bytes_sent "$http _referer"
"$http _accept_language" "$http _user_agent"

③ Custody Exit

Restart Nginx

Open Nginx log file, find Error.log,tail-f Error.log, found the following error

From the first line can be found to be a PHP error, search problems, found that PHP is limited to the operation of the directory, now can only operate in the/tmp/folder, so in the nginx of the Www-root folder can not operate, so attack the error of rebuffed access

Processing plan:
① Open php.ini File
② Find Open_basedir place.
③ the line, comment out the meaning is that PHP can operate in any folder, if you want to be able to run under the specified folder, the Open_basedir set to the appropriate directory
④ Custody and exit

Restart PHP-FPM Service PHP-FPM restart

Then visit the Web page and discover that the problem is addressed.

Thank you for reading, I hope to help you, thank you for your support for this site!

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.