Answer the question
In order to leave comments, you need to log in
Single entry point on nginx+php-fpm?
I need any request to be redirected to index.php. I try this (taken from some site):
server {
server_name 192.168.1.20;
listen 80;
root /home/abc/www;
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/home/abc/service/php-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
Answer the question
In order to leave comments, you need to log in
Everything is logical - if it info.php
exists, it will not reach the try_files
first location /index.php?$args
, the request will move to the second location and be processed in the usual way.
If you want all your php files to be redirected to index.php
- modify accordingly try_files
or just add a rewrite to /
.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question