Hi All,
It looks like Nginx can’t pass the php file to php-fpm.sock which results in download of php files instead of execution. Please help.
I set cgi.fix_pathinfo=0 inside /etc/php5/fpm/php.ini
I set listen = /var/run/php5-fpm.sock inside /etc/php5/fpm/pool.d/www.conf
My Droplet: Ubuntu 14.04 x64\Laravel 4\nginx\PHP-FPC
All packages seem to be latest - I got everything yesterday via apt-get update/upgrade.
//////////////////Start nginx config /etc/nginx/sites-available/default////////////
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/laravel/public;
index index.php index.html index.htm;
server_name MY_SERVER_IP_IS_HERE;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
//////////////////End nginx config/////////////////
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
In my case, I forgot didn’t install PHP yet. Make sure you already installed it by typing php -v. If there is no version information about your PHP, then you should install it with:
sudo apt updatesudo apt install php-fpmHey Folks, just ran into this myself working with Wordpress. Try using:
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
Referenced it from a working server, then ran a quick search for additional info. Chris_O from StackExchange recommends adding this to your php location block as well if you’re running php-fpm. – If you don’t already have it in your php-fpm.conf.
location ~ \.php {
try_files $uri =404;
Cheers!
Kamal, thank you for your answer. I cleared my cache prior to posting… What solved it, is the REBOOT of the server!
Perhaps, this documentation (https://www.digitalocean.com/community/tutorials/how-to-install-laravel-with-an-nginx-web-server-on-ubuntu-14-04) can be updated by adding “server reboot” if users can’t see the changes
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.
