Nginx Php files

1

I'm studying nginx and it seems to be faster than good apache. My doubt is. I have nginx already installed and running (with the welcome msg). I created an index.php page and automatically the server gives me a 403 return, if I create a page index.html the text file is interpreted. If I create a test / index.php directory the directory is recognized but the php file does not.

Sorry for the question but after searching a few hours I could not really understand what happens, it seems that the server does not read php files. I use ubuntu and installed:

sudo apt-get install nginx php5-fpm
sudo apt-get install php5-cli php5-curl php5-xdebug php5-intl php-pear

I followed this tutorial: link

If anyone can help me, it will be a great help. Abs

My default file

    
asked by anonymous 09.04.2016 / 22:16

1 answer

1

I found the solution on the Digital Ocean site ( link ).

This part of my default file (/ etc / nginx / sites-available / default) I needed to uncomment

  # pass the PHP scripts to FastCGI server listening on the php-fpm socket
    location ~ \.php$ {
            try_files $uri =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;

    }

In my case I had to configure the php.ini file (sudo nano /etc/php5/fpm/php.ini) There is this line cgi.fix_pathinfo = 0 which was commented out and I changed the value that was 1 to 0.

Obg to Sergio who tried to help me.

    
10.04.2016 / 01:02