Home > Article > Backend Development > 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!