Nginx下载php文件而不是执行

问题描述 投票:0回答:1

我开始加载根域和类别或页面。但我无法登录/ admin /或/ phpmyadmin /而是下载application / octet-stream文件。

可以做些什么?谢谢

这是我的conf文件:

server { 
listen 80; 
listen [::]:80;   #Use this to enable IPv6 
server_name localhost; 
root /var/www/html/;

index index.php;

location / {
try_files $uri $uri/ @rewriteapp; }

location @rewriteapp {
# rewrite all to index.php
rewrite ^(.*)$ /index.php/$1 last; }

# Php configuration location ~ ^/(index|index_dev)\.php(/|$) {
# Php-FPM Config (Socks or Network) 
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
# fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; }




# Security. discard all files and folders starting with a "." location ~ /\. {
deny  all;
access_log off;
log_not_found off; }
# Stuffs location = /favicon.ico {
allow all;
access_log off;
log_not_found off; } location ~ /robots.txt {
allow  all;
access_log off;
log_not_found off; }

# Static files location ~* ^.+\.(jpg|jpeg|gif|css|png|js|pdf|zip)$ {
expires     30d;
access_log  off;
log_not_found off; } 
}
php nginx configuration
1个回答
0
投票

我有类似的问题

    location = /images/favicons/site.webmanifest {
    log_not_found off;
    access_log off;
}

它下载文件而不是仅显示

编辑:

我找到了一个有效的解决方案,但不知道是否最好...

location = /images/favicons/site.webmanifest {
    default_type webmanifest;
    log_not_found off;
    access_log off;
}
© www.soinside.com 2019 - 2024. All rights reserved.