仅下载Nginx + Apache Index.php

时间:2016-05-12 21:31:43

标签: php apache .htaccess nginx downloading

我不确定导致此错误的内容真的很奇怪,基本上我的所有php,html和图像文件都正确提供,但正在下载index.php。我在我的网站上有各种链接,使用myBB重定向到/index.php但不是重定向到index.php下载它。如果我转到我的域名,它显示完全正常。简单的修复只是用root html替换/index.php重定向或只是将其重定向到root html。

我的服务器使用Nginx基本上运行所有不是php的东西,并提供服务器端加密。

HTTP Nginx虚拟服务器

server {
        listen   80;
        listen   [::]:80 default_server ipv6only=on;

        root /var/www/html; 
        index index.php index.html index.htm;

        server_name localhost;



        location ~ \.php$ {

        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:8080;

         }
        location / {
           try_files $uri $uri/ /index.php?$args;
         }

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

SSL Nginx虚拟服务器

server {

    listen 443;
    listen   [::]:443 default_server ipv6only=on;
    root /var/www/html; 
    index index.php index.html index.htm;

    server_name localhost; 

    ssl on;
    ssl_certificate /etc/nginx/ssl/nginx.crt;
    ssl_certificate_key /etc/nginx/ssl/nginx.key;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

    access_log   /var/log/nginx/server.access.log;
    error_log    /var/log/nginx/server.error.log;


ssl_ciphers "Removed";
SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_dhparam /etc/nginx/ssl/dhparam.pem;

   location / {
       try_files $uri $uri/ /index.php?$args;
     }


location ~ \.php$ {

    proxy_set_header X-Real-IP  $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header Host $host;
    proxy_pass http://127.0.0.1:8080;

     }

location ~ /\.ht {
    deny all;
    }



location ~ /error.log 
{ 
    deny all; 
}

NGINX .HTACCESS规则

rewrite ^/forum-([0-9]+).html$ /forumdisplay.php?fid=$1 last;

rewrite ^/forum-([0-9]+)-page-([0-9]+).html$ /forumdisplay.php?fid=$1&page=$2 last;

rewrite ^/thread-([0-9]+).html$ /showthread.php?tid=$1 last;

rewrite ^/thread-([0-9]+)-page-([0-9]+).html$ /showthread.php?tid=$1&page=$2 last;

rewrite ^/thread-([0-9]+)-lastpost.html$ /showthread.php?tid=$1&action=lastpost last;

rewrite ^/thread-([0-9]+)-nextnewest.html$ /showthread.php?tid=$1&action=nextnewest last;

rewrite ^/thread-([0-9]+)-nextoldest.html$ /showthread.php?tid=$1&action=nextoldest last;

rewrite ^/thread-([0-9]+)-newpost.html$ /showthread.php?tid=$1&action=newpost last;

rewrite ^/thread-([0-9]+)-post-([0-9]+).html$ /showthread.php?tid=$1&pid=$2 last;

rewrite ^/post-([0-9]+).html$ /showthread.php?pid=$1 last;

rewrite ^/announcement-([0-9]+).html$ /announcements.php?aid=$1 last;

rewrite ^/user-([0-9]+).html$ /member.php?action=profile&uid=$1 last;

rewrite ^/calendar-([0-9]+).html$ /calendar.php?calendar=$1 last;

rewrite ^/calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+).html$ /calendar.php?calendar=$1&year=$2&month=$3 last;

rewrite ^/calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)-day-([0-9]+).html$ /calendar.php?action=dayview&calendar=$1&year=$2&month=$3&day=$4 last;

rewrite ^/calendar-([0-9]+)-week-(n?[0-9]+).html$ /calendar.php?action=weekview&calendar=$1&week=$2 last;

rewrite ^/event-([0-9]+).html$ /calendar.php?action=event&eid=$1 last;

0 个答案:

没有答案