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;
   }

}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章