NGINX and PHP-FPM does not handle code include (shows your browser source). Why?

Set up a new server with nginx 1.6.0, and PHP 5.5.15 (PHP-FPM). Faced with such a problem that the PHP files with NGINX location redirect not handled by PHP, and the browser shows the source code.
Config for the domain:
server {
 listen 80;
 server_name www.domain.com domain.com;

 root /var/www/domain.com/;

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

 location /cms {
 rewrite ^(.*)$ /index.php?q=$1 last;
}
 location /tags/ {
 rewrite ^/(.+)$ /cms/index.php?q=$1 last;
}

 include /etc/nginx/templates/default;
 include /etc/nginx/templates/php;
}


Code templates/php:
# Pass the PHP processing script PHP-FPM
location ~ \.php$ {
 try_files $uri =404; 
 #PHP-FPM listening on a Unix socket
 location unix:/tmp/wwwpool.sock;

 #To use a cache area one
 fastcgi_cache one;

 #Put the page into the cache after 3 uses. 
 fastcgi_cache_min_uses 3;

 #Cache these answers
 fastcgi_cache_valid 200 301 302 304 5m;

 #The format of the cache key - this key is nginx finds the right page
 fastcgi_cache_key "$request_method|$host|$request_uri";

 fastcgi_index index.php;
 fastcgi_intercept_errors on; # only for testing period

 # Include the settings from /etc/nginx/fastcgi_param
 include fastcgi_params;

 # Path to the script that will be passed to php-fpm
 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 fastcgi_ignore_client_abort off;
}


The nginx configuration.conf:
user www-data;
worker_processes auto;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events {
 worker_connections 1024;
 use epoll;
}

http {
 fastcgi_cache_path /tmp/fcgi-cache/ levels=1:2 keys_zone=one:10m;
 server_tokens off;

 include /etc/nginx/mime.types;
 default_type application/octet-stream;
 #default_type text/html;

 "log_format" main '$remote_addr - $remote_user [$time_local] "$request" '
 '$status $body_bytes_sent "$http_referer" '
 '"$http_user_agent" "$http_x_forwarded_for"';

 #access_log /var/log/nginx/access.log main;
 error_log /var/log/nginx/error.log crit;

 sendfile on;
 tcp_nopush on;
 tcp_nodelay on; 

 keepalive_timeout 20;
 client_body_timeout 30;
 timeout 20;
 client_max_body_size 10m;

 reset_timedout_connection on; 

##
 # Gzip Settings
##
 gzip on;
 gzip_min_length 2100;
 "gzip_disable" "msie6";
 gzip_proxied any;
 gzip_comp_level 4;
 gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
 gzip_vary on; 

 include /etc/nginx/sites-enabled/*;
}


In particular when calling any page domain.com/tags/exampl1 the browser shows the source code of the page /cms/index.php. Ie
In the settings PHP.ini the Directive short_open_tag = On
September 26th 19 at 07:26
1 answer
September 26th 19 at 07:28
Solution
Try removing the line with "try_files" from this design:
location ~ \.php$ {
 try_files $uri =404;


In php.ini short_open_tag enabled?
What happens if you create a file with the contents:
<?php phpinfo(); ?>
and try to open it through the browser?
Removed the line try_files $uri =404 seems to work - Gus commented on September 26th 19 at 07:31

Find more questions by tags NginxPHP-FPM