首页 > 解决方案 > Nginx 下载 index php 而不是在 Wordpress 站点中提供它

问题描述

正如标题所说,nginx 下载索引 php。我有一个 wordpress 网站,并且我已经为我的域颁发了 ssl 证书。

只是提到如果我去https://example.com/index.php然后它会进入主页并按其应有的方式工作,但如果我去https://example.com它会下载 index.php 文件。

以下是我的服务器上下文:

server {
listen 443;

ssl on;

ssl_certificate /etc/nginx/ssl/bundle.crt;

ssl_certificate_key /etc/nginx/ssl/priv.key;



ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !RC4";

server_name example.com www.example.com;

root /var/www/mywebsite/;

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

 location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?q=$uri&$args;
limit_req zone=myzone burst=200;
  }

rewrite wp-content/uploads(/_pda/.*\.\w+)$ "/index.php?pda_v3_pf=$1" last;
rewrite private/([a-zA-Z0-9-_]+)$ "/index.php?pda_v3_pf=$1&pdav3_rexypo=ymerexy" last;

error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;

location = /50x.html {
   root /usr/share/nginx/html;
  } 

location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
include snippets/fastcgi-php.conf;
 }

location ~* (\.css|\.pdf)$ {
valid_referers blocked irir.lv;
if ($invalid_referer) {
return 444;
  }
}

location ~*  \.(jpg|jpeg|png|gif|ico|css|js|pdf)$ {
expires 365d;
}

location ~ /\.ht {
deny all;
}
}

任何帮助将非常感激

标签: wordpressnginx

解决方案


推荐阅读