Recently began to study Nginx.
Made the setting for this link http://help.ubuntu.ru/wiki/nginx-phpfpm

votan@votan-N53SN:/etc/nginx/sites-enabled$ cat example.com include common/upstream; server { listen 80; listen 443 ssl; root /var/www/html; index index.php index.html index.htm; server_name example.com www.example.com; client_max_body_size 200m; fastcgi_buffers 64 4K; location "/" { index index.php index.html index.htm; # варианты индексных файлов если имя файла в запросе не задано try_files $uri $uri/ =404; # проверить есть ли файл из запроса на диске, иначе - вернуть ошибку 404 } } 

The server starts but when you go to example.com or localhost, this page comes out. enter image description here

Under the link localhost / index.php - the index.php file is downloading

Php-fpm / etc / nginx / common / php-fpm

 # Настройки порта или сокета PHP-FPM производятся в файле "/etc/php5/fpm/pool.d/www.conf" fastcgi_pass php-fpm; # Порядок важен - строчка "include fastcgi_params" должна быть первой include fastcgi_params; fastcgi_split_path_info ^(.+?\.php)(/.*)?$; # Вместо переменной "$document_root" можно указать адрес к корневому каталогу сервера и это желательно (см. http://wiki.nginx.org/Pitfalls) fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name; # См. http://trac.nginx.org/nginx/ticket/321 set $path_info $fastcgi_path_info; fastcgi_param PATH_INFO $path_info; # Additional variables fastcgi_param SERVER_ADMIN email@example.com; fastcgi_param SERVER_SIGNATURE nginx/$nginx_version; fastcgi_index index.php; 
  • Time: it is quite possible that the page has been eaired, try Ctrl + Shift + R. Two: there is not a single line about php-fpm in the config, no one will be doing php-code, it should just be downloaded. Three: comment to try_files is not quite correct - andreymal
  • You still have nothing in the config about php ... - Pavel Mayorov
  • added / etc / nginx / common / php-fpm - votanko

1 answer 1

Add pfp processing to config

  location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_split_path_info ^(/)(/.*)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } 
  • added example.com to the end - nothing has changed - votanko
  • it needs to be inserted into the server {} section, after which php scripts will work for you - santer