ubuntun安装php

安装nginx

 sudo apt install nginx 

安装php

 sudo apt install php7.2

配置nginx虚拟主机

server
{ 
    listen 80;
    server_name api.example.com;
    index  index.php index.html;
    root /www/wwwroot;

    location / {
     if (!-e $request_filename){
          rewrite ^/(.*)$ /index.php/$1 last;
      }
    }

    location ~* \.php$ {
        fastcgi_pass unix:/run/php/php7.2-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include /etc/nginx/fastcgi_params;
   }

}

你可能感兴趣的:(php)