<div dir="ltr">Hi,<div>Haven't used nginx in few years and trying to get it into production.</div><div><br></div><div>i'm having what will probably be a silly misconfiguration to most. I'm running nginx </div><div><span class=""><b>nginx</b></span><span class="">-1.8.0-1.el7.ngx.x86_64</span></div><div><span class="">CentOS 7</span></div><div><span class="">with PHP-fpm</span></div><div><span class=""><br></span></div><div><span class="">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.</span></div><div><span class=""><br></span></div><div>Any direction would be great</div><div><br></div><div>Thanks,</div><div>James</div><div><span class=""><br></span></div><div><span class="">Here is my config:</span></div><div><span class=""><br></span></div><div><span class="">
<p class=""><span class="">server {</span></p>
<p class=""><span class=""> listen 80;</span></p>
<p class=""><span class=""> server_name <a href="http://www.imagesite.net">www.imagesite.net</a> *.<a href="http://imagesite.net">imagesite.net</a>;</span></p>
<p class=""><span class=""> root /var/www/<a href="http://imagesite.net/html">imagesite.net/html</a>;</span></p>
<p class=""><span class=""> index index.php;</span></p>
<p class=""><span class=""> error_page 404 /404.html;</span></p>
<p class=""><span class=""></span><br></p>
<p class=""><span class=""> # redirect server error pages to the static page /50x.html</span></p>
<p class=""><span class=""> #</span></p>
<p class=""><span class=""> error_page 500 502 503 504 /50x.html;</span></p>
<p class=""><span class=""> location = /50x.html {</span></p>
<p class=""><span class=""> root /usr/share/nginx/html;</span></p>
<p class=""><span class=""> }</span></p>
<p class=""><span class=""></span><br></p>
<p class=""><span class=""> # pass the PHP scripts to FastCGI server listening on <a href="http://127.0.0.1:9000">127.0.0.1:9000</a></span></p>
<p class=""><span class=""> #</span></p>
<p class=""><span class=""> location ~ \.php$ {</span></p>
<p class=""><span class=""> root html;</span></p>
<p class=""><span class=""> fastcgi_pass <a href="http://127.0.0.1:9000">127.0.0.1:9000</a>;</span></p>
<p class=""><span class=""> fastcgi_intercept_errors on;</span></p>
<p class=""><span class=""> fastcgi_index index.php;</span></p>
<p class=""><span class=""> fastcgi_param SCRIPT_FILENAME /var/www/<a href="http://imagesite.net/html$fastcgi_script_name">imagesite.net/html$fastcgi_script_name</a>;</span></p>
<p class=""><span class=""> include fastcgi_params;</span></p>
<p class=""><span class=""> }</span></p>
<p class=""><span class=""></span><br></p>
<p class=""><span class=""> # deny access to .htaccess files, if Apache's document root</span></p>
<p class=""><span class=""> # concurs with nginx's one</span></p>
<p class=""><span class=""> #</span></p>
<p class=""><span class=""> location ~ /\.ht {</span></p>
<p class=""><span class=""> deny all;</span></p>
<p class=""><span class=""> }</span></p>
<p class=""><span class=""></span><br></p>
<p class=""><span class=""> autoindex off;</span></p>
<p class=""><span class=""> location / {</span></p>
<p class=""><span class=""> autoindex off;</span></p>
<p class=""><span class=""> rewrite ^/([^/]*)/([^/]*)/([^/]*)\.html$ /item.php?parentcategorie=$1&categorie=$2&fx=$3 break;</span></p>
<p class=""><span class=""> rewrite ^/([^/]*)/$ /cat.php?parentcategorie=$1 break;</span></p>
<p class=""><span class=""> rewrite ^/([^/]*)/([^/]*)/$ /subcat.php?parentcategorie=$1&categorie=$2 break;</span></p>
<p class=""><span class=""> rewrite ^/([^/]*)/([^/]*)/([^/]*)/([^/]*)\.html$ /page.php?parentcategorie=$1&categorie=$2&fx=$3&img=$4 break;</span></p>
<p class=""><span class=""> try_files $uri $uri/ =404;</span></p>
<p class=""><span class=""> }</span></p>
<p class=""><span class=""></span><br></p>
<p class=""><span class="">}</span></p></span></div>
</div>