简体   繁体   中英

Nginx downloads php file instead executing

I get to load root domain and categories or pages. But I can't login to /admin/ or /phpmyadmin/ but instead it downloads application/octet-stream file.

What can be done? Thanks

Here's my conf file:

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; } 
}

i had a similar problem with

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

it download the file instead of display only

edit:

i found a solution that work, but don't know if the best...

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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