I am installing a website in a droplet (Digital Ocean). I have an issue for install NGINX with PHP properly. I did a tutorial https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-14-04 but when I try to run some .php files it’s just downloading it…
for example… http://5.101.99.123/info.php it’s working but… If I go to the main http://5.101.99.123 it’s downloading my index.php :/
Any idea?
-rw-r–r– 1 agitar_user www-data 418 Jul 31 18:27 index.php
-rw-r–r– 1 agitar_user www-data 21 Aug 31 11:20 info.php
My /etc/nginx/sites-available/default
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/html;
index index.html index.htm index.php;
# Make site accessible from http://localhost/
server_name agitarycompartir.com;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
## NOTE: You should have “cgi.fix_pathinfo = 0;” in php.ini
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location / {
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
…
Other “locations” are commented on…
.
Try this: .\n\nEdit /etc/nginx/sites-available/default .\n\nNginx listen on port 80 IPv4 &IPv6. listen 80; ## listen for ipv4. This line is default and implied and implies listen [::]:80 default_server ififonly=on; ‘# listen to adv6).\n\nLeave server_name alone # Make site accessible (…) server-name localhost; .\n\nIndex.php: Index line root /usr/share/nginx/www; index index,php index.htmlindex.htm; .\n\nphp.ini: \”cgi.fix_pathinfo = 0;\” in order to \”pass the PHP scripts\” to FastCGI server listening on (…) # # .php$ (in (…) (…) $ $__files), $uri =404; fastcti_split_fith_their_info ? (.+)\n\n# #fastcgi_pass 127.0.0.1:9000; # With php5-fpm: fastcgui-pass unix:/var/run/php5,-ppm.sock; fast Cgil-indexindex index.php; .\n\nEdit /etc/php5/fpm/ PHP.ini and ensure that cgi.fix_pathinfo is 0 .\n\n&& sudo service php5-fpm restart. Restart Nginx .\n\n\n\nI just started using Linux a week ago. I really hope you can help you with this. My nano text editor is editing the files. run apt-get install nano if you don\’t have it. Google it to know more.