@Belkin

Почему при переходе по http скачивается файл, а при https сайт загружается?

Если заходить на сайт по http, то скачивается файл с содержимым:
А€€€€
По https сайт открывается и работает.
сайт работает на ocstore и nginx без apache
код настроек nginx
server {
     listen 80 http2;
     listen [::]:80 http2;
     server_name me.fun www.me.fun; ## Your Domain
     root /var/www/html/mefun;
     return 301 https://$server_name$request_uri;
}

server {
    server_name localhost me.fun www.me.fun; ## Your Domain
    root /var/www/html/mefun; ## Web Root Directory
    index index.php index.html index.htm;

    client_max_body_size 64m;

    listen 443 default_server ssl http2;
    listen [::]:443 default_server ssl http2;

    ssl_certificate /etc/ssl/me.fun.crt;      
    ssl_certificate_key /etc/ssl/me.fun.key;
    ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers         HIGH:!aNULL:!MD5;

    location /image/data {
        autoindex on;
    }
    location /admin {
        index index.php;
    }
    location / { try_files $uri @opencart; }
    location @opencart { rewrite ^/(.+)$ /index.php?_route_=$1 last; }

    
    # Make sure files with the following extensions do not get loaded by nginx because nginx would display the source code, and these files can contain PASSWORDS!
    location ~* \.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|\.php_ {
        deny all;
    }
    #Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
    location ~ /\. {
          deny all;
          access_log off;
          log_not_found off;
    }
    location ~*  \.(jpg|jpeg|png|gif|css|js|ico)$ {
        expires max;
        log_not_found off;
    }
    location ~ [^/]\.php(/|$) {
    	fastcgi_split_path_info  ^(.+\.php)(/.+)$;
    	fastcgi_index            index.php;
    	fastcgi_pass             unix:/var/run/php/php7.1-fpm.sock; # Ubuntu 17.10
    	include                  fastcgi_params;
    	fastcgi_param   PATH_INFO       $fastcgi_path_info;
    	fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

      #pagespeed
	pagespeed off;
	pagespeed RewriteLevel CoreFilters;
	pagespeed FileCachePath "/var/cache/ngx_pagespeed/";
	# Ensure requests for pagespeed optimized resources go to the pagespeed
	# handler and no extraneous headers get set.
	location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { add_header "" ""; }
	location ~ "^/ngx_pagespeed_static/" { }
	location ~ "^/ngx_pagespeed_beacon" { }


    

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


}
  • Вопрос задан
  • 857 просмотров
Решения вопроса 1
@Belkin Автор вопроса
решение убрать http2 из первого блока!
Ответ написан
Комментировать
Пригласить эксперта
Ответы на вопрос 1
@ynblpb_spb
дятел php
server {
     listen 80 http2;
     listen [::]:80 http2;
     server_name me.fun www.me.fun; ## Your Domain
     root /var/www/html/mefun;
     location / {
                rewrite ^/(.*)$ https://$host/$1 permanent;
     }
}

попробуйте так
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы