Ответы пользователя по тегу Nginx
  • Как настроить nginx + php_fastcgi с функциональностью Apache_mpm_itk + mod_php?

    Sky4eg
    @Sky4eg
    Web разработчик
    Я делал несколько иначе. Вот пример на ubuntu

    фрагмент конфига сайта
    /etc/nginx/sites-available/site.ru

     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;
            }
    


    далее фрагмент
    /etc/php5/fpm/pool.d/site.ru.conf

    ; Start a new pool named 'www'.
    ; the variable $pool can we used in any directive and will be replaced by the
    ; pool name ('www' here)
    [site.ru]
    
    ...
    
    ; Unix user/group of processes
    ; Note: The user is mandatory. If the group is not set, the default user's group
    ;       will be used.
    user = sky
    group = sky
    
    ...
    
    ; The address on which to accept FastCGI requests.
    ; Valid syntaxes are:
    ;   'ip.add.re.ss:port'    - to listen on a TCP socket to a specific address on
    ;                            a specific port;
    ;   'port'                 - to listen on a TCP socket to all addresses on a
    ;                            specific port;
    ;   '/path/to/unix/socket' - to listen on a unix socket.
    ; Note: This value is mandatory.
    ;listen = 127.0.0.1:9000
    listen = /var/run/php5-fpm.sock
    
    ...
    
    ; Set permissions for unix socket, if one is used. In Linux, read/write
    ; permissions must be set in order to allow connections from a web server. Many
    ; BSD-derived systems allow connections regardless of permissions.
    ; Default Values: user and group are set as the running user
    ;                 mode is set to 0666
    listen.owner = sky
    listen.group = sky
    listen.mode = 0666
    
    ...
    


    После это сайт работает от имени пользователя, в данном случае sky
    Ответ написан
    1 комментарий