Home  >  Article  >  Backend Development  >  nginx cannot parse php

nginx cannot parse php

王林
王林Original
2019-10-09 17:42:095588browse

nginx cannot parse php

First install php-fpm

yum install php-fpm
service php-fpm start    #启动 php-fpm

Then modify the nginx configuration file nginx.conf to identify php

vi /usr/local/nginx/conf/nginx.conf Add a piece of code

location ~ \.php$ {
   #fastcgi_split_path_info ^(.+\.php)(/.+)$;
            root          /usr/share/nginx/html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME /usr/share/nginx/html/$fastcgi_script_name;
            include        fastcgi_params;
#$document_root
        }

Finally restart nginx and php-fpm

service nginx restart
service php-fpm restart

Recommended tutorial:PHP video tutorial

The above is the detailed content of nginx cannot parse php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:php die exit differenceNext article:php die exit difference