8
8
891099838382015-09-25 12:41:19
Nginx
89109983838, 2015-09-25 12:41:19

Nginx return contents of Opencart php file?

There is a site on Opencart running on a bunch of Nginx + php5-fpm. everything is fine - except for one problem! One of the modules emits the contents of itself (php) instead of processing the request. In general, for example:
paths are processed as expected:
to the products site.ru/index.php?route=product/product&product_id=11
to one of the modules site.ru/index.php?route=product/pricelist
And here is the request site.ru/ index.php?route= module/click/order returns the content of the file.
(Moreover, click is a module file, order is a function in it)
There is no such problem in an exact copy of the Apache site!!! therefore, I pear on my knowledge of the nginx settings, the
main content of the Nginx settings file for the site:

server {
  listen        80;
  server_name   site.ru;
  server_tokens off;
  client_body_buffer_size 128k;
  charset utf8;
  client_max_body_size 500m;
  
  root /var/www/web/site.ru;
  index index.php;
  location ~*  .(jpg|jpeg|png|gif|ico|css|js)$ { expires 365d; }
  
  location /admin { index index.php; }
  location / { try_files $uri @opencart; }
  location @opencart { rewrite ^/(.+)$ /index.php?_route_=$1 last; }
  
  rewrite ^/sitemap.xml$ /index.php?route=feed/google_sitemap;
  
  location  ~ \.php$ {
  fastcgi_pass 127.0.0.1:9001;
  fastcgi_index index.php;
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  include fastcgi_params;
  }
  
  }

prompt where to dig???

Answer the question

In order to leave comments, you need to log in

2 answer(s)
8
89109983838, 2015-09-25
@89109983838

htaccess standard let's say so!

Options +FollowSymlinks
Options -Indexes
<FilesMatch "\.(tpl|ini|log)">
 Order deny,allow
 Deny from all
</FilesMatch>

RewriteEngine On
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

nothing to do with this!
It gave why nginx gives the above as static, and does not transfer it to php5-fpm for processing.
################################# LATER###
the floor of the problem was solved in an elementary way:
It turns out the php file started with <? and not with <?php so it wasn't treated as a php script!!!!
he began to process! only as a whole, and not a separate function in it that we call
, respectively, this is also not functional ..... because doesn't give you what you need!
###################
Add that the query is transmitted by the POST method - maybe nginx does not transmit them ??? so the processing flies?
##############################DECISION###############
Disabling gzip in nginx settings solved the problem with POST requests!
Does anyone know how to get around this!? Or I think it's better to create a separate topic!

V
Vlad Zhivotnev, 2015-09-25
@inkvizitor68sl

in htaccess native what?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question