Инструменты пользователя

Инструменты сайта


Боковая панель


Программное обеспечение
Черновики


Краткая инструкция

howto:services:nginx:install

Это старая версия документа!


Nginx + php5-fpm

apt-get install nginx php5-fpm

nano /etc/php5/fpm/php.ini

;cgi.fix_pathinfo = 1
cgi.fix_pathinfo = 0

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

;security.limit_extensions = .php .php3 .php4 .php5
security.limit_extensions = .php

.....

listen.owner = www-data
listen.group = www-data
listen.mode = 0660

nano /etc/nginx/sites-available/example.com

server {
        listen 80;
        root /var/www/example;
        index index.php index.html index.htm;
        server_name example example.com;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }

        #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$ {
                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;
        }

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

ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/

howto/services/nginx/install.1547722219.txt.gz · Последние изменения: 2019/01/17 13:50 — Алексей Кожевников