Nginx下載PHP文件而不是執行它們

分享于 

1分钟阅读

互联网

  简体

问题:

以下是服务器块:


server {


 server_name example.com;


 listen 443 ssl;


 listen [::]:443 ssl;


 ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;


 ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;


 include /etc/letsencrypt/options-ssl-nginx.conf;


 ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;



 return 301 https://www.example.com$request_uri;


}



server {


 server_name www.example.com;


 listen 443 ssl;


 listen [::]:443;


 ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;


 ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;


 include /etc/letsencrypt/options-ssl-nginx.conf;


 ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;



 root /var/www/example.com/public;


 index index.html index.htm index.nginx-debian.html index.php;


 location / {


 try_files $uri $uri/ =404;


 }


}




答案1:

理解Nginx只是一个web服务器,而不是一个php应用服务器。

你需要PHP fpm



文件  PHP  files  EXE  EXEC  Nginx  
相关文章