Nginx files Php

Asked

Viewed 1,235 times

1

I’m studying about Nginx and it seems to be faster than good old Apache. My doubt is. I have the 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 an index.html page the text file is interpreted. If I create a test/index.php directory the directory is recognized but the php file is not.

I’m sorry for the question but after searching a few hours I couldn’t understand exactly what happens, it seems that the server does not read php files. I wear a Buntu and install:

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:http://www.erikaheidi.com/pt_br/blog/nginx-php5-fpm-instalacao-passo-a-passo

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

My default file

  • How is your /etc/nginx/sites-available/default?

  • sorry I couldn’t post the file here but it’s on github now https://github.com/digomes87/your-portfolio/blob/master/nginx

  • Only php files do not work? Appears some error message written "in input"?

  • only the php files, only return I have is the 403 Forbidden

1 answer

1

I found the solution on the Digital Ocean website(https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-12-04).

This is my snippet in the default file(/etc/Nginx/sites-available/default) I needed to discolour

  # 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 cgi.fix_pathinfo=0 line that was commented descimentei and changed the value that was 1 to 0.

Obg to Sergio who tried to help me.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.