nginx и php5-fpm не работают

перед тем, что я искал везде и тестировал все, но все еще не работал. Я устанавливаю php5-fpm и nginx, когда открываю localhost в браузере. Я вижу эту страницу:

Добро пожаловать в nginx!

], поэтому его работа теперь настраивает php5-fpm с nginx:

/etc/php5/fpm/pool.d/www.conf

  user = www-data
  group = www-data
  listen = /var/run/php5-fpm.sock
  listen.owner = www-data
  listen.group = www-data
  pm = dynamic
  pm.max_children = 5
  pm.start_servers = 2
  pm.min_spare_servers = 1
  pm.max_spare_servers = 3
  chdir = /

прокомментированы все остальные строки, и это это nginx conf:

  upstream php {
        server unix:/var/run/php5-fpm.socket;
  }

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

root /usr/share/nginx/html;
index index.html index.htm index.php;

# Make site accessible from http://localhost/
server_name localhost;

location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    try_files $uri $uri/ =404;
    # Uncomment to enable naxsi on this location
    # include /etc/nginx/naxsi.rules
}

# Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
#location /RequestDenied {
#   proxy_pass http://127.0.0.1:8080;    
#}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
#   root /usr/share/nginx/html;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;

}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
#   allow all;
#}
}

проблема в том, что когда я пытаюсь запустить php-файлы, nginx будет загружать php-файл вместо его выполнения

1
задан 5 August 2014 в 11:42

1 ответ

Вы можете попробовать EasyEngine, который может настроить веб-сервер с помощью одной команды

Docs / wiki: EasyEngine

Как настроить: http: // www. unixmen.com/easyengine-auto-installer-script-managing-wordpress-nginx-websites-ubuntu-debian/

0
ответ дан 24 May 2018 в 04:58

Другие вопросы по тегам:

Похожие вопросы: