browser downloading html files

James Marcus marcus.james at gmail.com
Sat Jul 18 16:29:27 UTC 2015


Hi,
Haven't used nginx in few years and trying to get it into production.

i'm having what will probably be a silly misconfiguration to most.  I'm
running nginx
*nginx*-1.8.0-1.el7.ngx.x86_64
CentOS 7
with PHP-fpm

When I hit every PHP link on this site it generates some html and my
browser downloads it. I used the winginx .htaccess converter to create the
rewrite rules.

Any direction would be great

Thanks,
James

Here is my config:

server {

    listen 80;

    server_name www.imagesite.net *.imagesite.net;

    root /var/www/imagesite.net/html;

    index index.php;

    error_page  404              /404.html;


    # redirect server error pages to the static page /50x.html

    #

    error_page   500 502 503 504  /50x.html;

    location = /50x.html {

        root   /usr/share/nginx/html;

    }


    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

    #

    location ~ \.php$ {

        root           html;

        fastcgi_pass   127.0.0.1:9000;

        fastcgi_intercept_errors on;

        fastcgi_index  index.php;

        fastcgi_param  SCRIPT_FILENAME  /var/www/
imagesite.net/html$fastcgi_script_name;

        include        fastcgi_params;

    }


    # deny access to .htaccess files, if Apache's document root

    # concurs with nginx's one

    #

    location ~ /\.ht {

        deny  all;

    }


    autoindex off;

    location / {

      autoindex off;

      rewrite ^/([^/]*)/([^/]*)/([^/]*)\.html$
/item.php?parentcategorie=$1&categorie=$2&fx=$3 break;

      rewrite ^/([^/]*)/$ /cat.php?parentcategorie=$1 break;

      rewrite ^/([^/]*)/([^/]*)/$
/subcat.php?parentcategorie=$1&categorie=$2 break;

      rewrite ^/([^/]*)/([^/]*)/([^/]*)/([^/]*)\.html$
/page.php?parentcategorie=$1&categorie=$2&fx=$3&img=$4 break;

      try_files $uri $uri/ =404;

      }


}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20150718/376f5092/attachment.html>


More information about the nginx mailing list