ubuntu+nginx+php环境搭建

ubuntu+nginx+php环境搭建

就这么简单个事,百度出来的乱七八糟,各种方法混在一起。其实就几个命令的事,改个配置的事

apt install nginx 

apt install php-fpm

安装完成后,编辑nginx配置文件

/etc/nginx/sites-available/default

location ~ \.php$ {
        #       include snippets/fastcgi-php.conf;
        #
        #       # With php-fpm (or other unix sockets):
                fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        #       # With php-cgi (or other tcp sockets):
        #       fastcgi_pass 127.0.0.1:9000;
        }

  

编辑/etc/nginx/fastcgi_params 最后两行加入

 

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO                $fastcgi_script_name;

  

启动服务

service php7.4-fpm start

servicer nginx start

完事

posted @ 2022-05-13 15:21  妇愁者纞萌  阅读(391)  评论(0编辑  收藏  举报