nginx cannot parse php

王林
Release: 2023-02-25 22:32:01
Original
5603 people have browsed it

nginx cannot parse php

First install php-fpm

yum install php-fpm
service php-fpm start    #启动 php-fpm
Copy after login

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
        }
Copy after login

Finally restart nginx and php-fpm

service nginx restart
service php-fpm restart
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template