繁体   English   中英

Ubuntu Nginx无法运行php

[英]Ubuntu nginx does't run php

我曾经使用lnmp 现在,我决定使用可升级的apt源。 我已经建立了MySQL和Nginx。 安装PHP和php-fpm ,我的nginx无法执行PHP。 它可以解析HTML。 这是我的虚拟主机的配置:

server {
   listen 80;
   server_name himeki.net;
   return 301 https://$server_name$request_uri;
   root /home/wwwroot;
   index index.html index.php index.htm;
   location ~ \.php$ {
      fastcgi_pass unix:/run/php/php7.0-fpm.sock;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include fastcgi_params;
   }
}

server {
   listen 443;
   server_name himeki.net;
   ssl on;
   ssl_certificate /etc/nginx/himeki.net.crt;
   ssl_certificate_key /etc/nginx/himeki.net.key;
   ssl_session_timeout 5m;
   ssl_protocols SSLv2 SSLv3 TLSv1;
   ssl_ciphers HIGH:!aNULL:!MD5;
   ssl_prefer_server_ciphers on;

   root /home/wwwroot;
   location ~ / {
      index index.html index.php index.html index.htm;
   }

   location ~ [^/]\.php(/|$)
           {
               try_files $uri =404;
               fastcgi_pass unix:/run/php/php7.0-fpm.sock;
               fastcgi_index index.php;
               include fastcgi.conf;
           }
}

最后,我改为使用“ Apache2”。 有用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM