.php文件下载而不是显示

时间:2019-06-05 14:55:13

标签: nginx fpm php-7.3

首先,是的,有很多类似的问题,但是没有一个解决方案对我有用。 我有一个类似的服务器要与之比较,我查看了配置,它似乎可以运行,而这种新设置却无效。

我已经尝试过修改配置,没有任何优势。

我的nginx.conf:

[default content]
#I just appended this line:
client_max_body_size 10M;

我的虚拟主机文件:

server {
    listen 80;
    listen [::]:80;

#    root /var/www/mywebsite.com/public_html;

 #   index index.html;

    server_name mywebsite.com www.mywebsite.com;

   # access_log /var/log/nginx/mywebsite.com.access.log;
   # error_log /var/log/nginx/mywebsite.com.error.log;
    include snippets/letsencrypt.conf;
    return 301 https://$host$request_uri;
   # location / {
   #     try_files $uri $uri/ =404;
    }
server {
    listen 443 ssl http2;
    server_name www.mywebsite.com;

    ssl_certificate /etc/letsencrypt/live/mywebsite.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/mywebsite.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/mywebsite.com/chain.pem;
    include snippets/ssl.conf;
    include snippets/letsencrypt.conf;

    return 301 https://mywebsite.com$request_uri;
}
server {
    listen 443 ssl http2;
    server_name mywebsite.com;

    ssl_certificate /etc/letsencrypt/live/mywebsite.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/mywebsite.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/mywebsite.com/chain.pem;
    include snippets/ssl.conf;
    include snippets/letsencrypt.conf;


    root /var/www/mywebsite.com/public_html;
    index index.php;
    # . . . other code

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
 }

#location / {
#        try_files $uri $uri/ /index.php?$args;
#}
#location ~ \.php$ {
#        fastcgi_split_path_info ^(/wordpress)(/.*)$;
#}

include snippets/phpmyadmin.conf;
}

PS是,我正在使用WordPress。

1 个答案:

答案 0 :(得分:0)

因此,这似乎只是一个缓存问题,因此我不得不等待,此后才起作用。配置正常。结案了。