安装Nginx支持php-fpm

> yum install -y nginx
> vi /etc/nginx/conf.d/default.conf
server {
    listen 80;
    server_name 服务器的ip地址 localhost;

    location / {
        root /usr/share/nginx/html/;
        index index.php  index.html  index.htm;
    }

    location ~ \.php$ {
        root /usr/share/nginx/html/;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME        $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}
> systemctl restart nginx
> vi /usr/share/nginx/html/index.php
<?php
	echo phpinfo();
?php>

访问ip地址 出现phpinfo()的内容

🙂

“安装Nginx支持php-fpm”的一个回复

发表评论

电子邮件地址不会被公开。 必填项已用*标注