Answer the question
In order to leave comments, you need to log in
Does Nginx download a php file when it opens?
When opening a .php file located at the root of the site, nginx downloads it. Tell me what could be the problem.
At the moment, the server is configured to hide .php extensions, and if there is no file in the root with that name, it redirects to profile?id=$uri.
server {
listen 80 default_server;
listen [::]:80 default_server;
index index.htm index.html index.php;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name _;
include hhvm.conf;
location / {
try_files $uri $uri/ $uri.php?$query_string /profile.php?id=$uri;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
include /etc/nginx/fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
}
Answer the question
In order to leave comments, you need to log in
Bring the location to the form:
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
include /etc/nginx/fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question