Nginx does not parse PHP code;

Source: Internet
Author: User
Tags fpm

Installation:
sudo apt-get install nginx php7.0-fpm mysql-server-5.6 php7.0-mysql

Then change the configuration file, PHP configuration file can not be used, nginx configuration file, PHP CGI is not supported by default, so it has to be changed:
vim/etc/nginx/sites-available/default
Find
#
#location ~ \.php$ {
# Include snippets/fastcgi-php.conf;
# # # with
php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# with PHP5-FPM:
# fastcgi_pass Unix:/var/run/php5-fpm.sock;
#}
changed to
location ~ \.php$ {
include snippets/fastcgi-php.conf;

# with php5-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
# with PHP5-FPM:
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
It probably means that all the files that have a positive ending to PHP are passed to PHP7.0-FPM to process, the results sent to Nginx, and then sent to the client by Nginx and
then restarted service:
systemctl restart Nginx
systemctl Restart php7.0-fpm
systemctl restart MySQL
just fine. The default site root is in/var/www/html/( Can through the Nginx configuration file in the root of the line to change the
main problem is to take WordPress and the like, to index.php as the homepage
is the Nginx configuration file in the
index index.html Index.htm index.nginx-debian.html;
Change into index.php

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.