0

I'm not sure whats causing this error its really strange, basically all of my php, html, and image files are being served correctly but index.php is being downloaded. I have various links on my site which uses myBB that redirects to /index.php but instead of redirecting to index.php its downloading it. If I instead go to my domain name it displays perfectly fine. The simple fix would just be replacing /index.php redirects with the root html or just redirecting it to root html.

My server uses Nginx to run basically everything that's not php as well as provides a server side encryption.

HTTP Nginx Virtual Server

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 Virtual Server

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 RULES

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;
Bret
  • 3
  • 4

0 Answers0