Answer the question
In order to leave comments, you need to log in
Problem with executing php files and single access point (nginx, php-fpm)?
Hello.
There is a config that rewrites requests to index.php, in which the routing is already disassembled and the corresponding controller is loaded. He does an excellent job with this task.
I honestly stole it from the symphony2 site, but there is one minus that I can’t beat. If you put any php file other than index.php, then it is not executed, but simply given to the race.
The problem arose when I tried to use xhprof.
server {
listen 80;
server_name point.local;
root /home/kulikov/www/point.local/httpdocs/;
location / {
try_files $uri @rewriteapp;
}
location @rewriteapp {
rewrite ^(.*)$ /index.php/$1 last;
}
location ~ ^/(index)\.php(/|$) {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
location ~* \.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf|flv|avi|djvu|mp3|mp4|ogv|3gp)$ {
root /home/kulikov/www/point.local/httpdocs;
}
error_log /home/kulikov/www/point.local/logs/nginx_error.log;
access_log /home/kulikov/www/point.local/logs/nginx_access.log;
}
Answer the question
In order to leave comments, you need to log in
server {
listen 80;
server_name point.local;
root /home/kulikov/www/point.local/httpdocs/;
try_files $uri /index.php?$args;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
location ~* \.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf|flv|avi|djvu|mp3|mp4|ogv|3gp)$ {
root /home/kulikov/www/point.local/httpdocs;
}
error_log /home/kulikov/www/point.local/logs/nginx_error.log;
access_log /home/kulikov/www/point.local/logs/nginx_access.log;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question