First, open the following lines of comments in the Nginx config file:
Location ~ \.php$ {root html; Fastcgi_pass 127.0.0.1:9000; Fastcgi_index index.php; Fastcgi_param Script_filename/usr/local/nginx/html$fastcgi_script_name; Include Fastcgi_params; Simply change the Script_filename file location to the one shown above
Then detect the Nginx configuration file is correct, note that every time you change the configuration file, you have to do this test!
[Email protected] html]#/usr/local/nginx/sbin/nginx-tnginx:the configuration file/usr/local/nginx/conf/nginx.conf Syntax is oknginx:configuration file/usr/local/nginx/conf/nginx.conf test is successful
Then reload the configuration file
/usr/local/nginx/sbin/nginx-s Reload
To create a PHP file:
cd/usr/local/nginx/html/create the file content as follows: Cat 2.php <?php echo "PHP works"; ?>
To parse the PHP file you just created with curl:
[Email protected] html]# Curl localhost/2.phpphp Works
The instructions can parse the PHP file correctly!
You can also enter command parsing in the browser,
http://192.168.1.123/2.php
If the word "PHP works" appears, the resolution is successful!
This article is from "Custom" blog, declined reprint!
Nginx parsing PHP