配置解析php
vim /usr/local/nginx/conf/nginx.conf //把下面的配置,前面的#删除,并更改fastcgi_param SCRIPT_FILENAME 那一行
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;
}
复制代码
重新加载 /usr/local/nginx/sbin/nginx -s reload
vim /usr/local/nginx/html/1.php
增加
<?php
phpinfo();
?>
测试: curl localhost/1.php
时间: 2024-12-28 17:56:00