Issue
I installed debian 8 with nginx and php 7 for creating an endpoint with zendframework. When i follow the website i have to add these to my virtual host config in nginx. Like i did see the code below:
server {
listen 80;
listen [::]:80;
root /var/www/endpoint/html/public;
server_name my_ip;
location / {
index index.php
try_files $uri $uri/ @php;
}
location @php {
# Pass the PHP requests to FastCGI server (php-fpm) on 127.0.0.1:9000
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /var/www/endpoint/html/public/index.php;
include fastcgi_params;
}}
But when i visit the website its downloading the index.php instead of executing the index.php.
I hope anyone can help me resolving this issue.
Solution
I think you need to replace the fastcgi_pass
value with socket path
instead of server address and port.
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
Then restart your php7-fpm
by type this command
sudo systemctl restart php7-fpm
Answered By - Dolly Aswin