How to install NGINX + PHP-FPM on Raspberry Pi

Тема в разделе "Raspberry", создана пользователем Транклюкатор, 30 янв 2018.

  1. Транклюкатор

    Транклюкатор Господин ПЖ

    Next we have prepared a simple tutorial on how to install the NGINX web server with PHP-FPM in Raspbian. It takes a few minutes to prepare Raspberry Pi to launch your website.

    1. Update/upgrade and a good habit is to install the time synchronization and postfix
    [email protected]:~# apt-get update && apt-get -y upgrade
    [email protected]:~# apt-get install postfix ntp ntpdate
    2. Install NGINX, PHP-FPM and APC cache package
    [email protected]:~# apt-get install nginx php5-fpm php-apc
    3. Install MySQL server and PHPMyAdmin if needed
    [email protected]rrypi:~# apt-get install mysql-client mysql-server php5-mysql phpmyadmin
    4. Add group and user for your domain. First uid and gid is 10000 and home user (domain) directory is in /home/
    [email protected]:~# addgroup --gid 10000 group001
    [email protected]:~# adduser --home /home/ --shell /dev/null --uid 10000 --gid 10000 --disabled-password --disabled-login --gecos '' user001
    5. Create structure logs and web directory
    [email protected]:~# mkdir /home/ # for Nginx logs
    [email protected]:~# mkdir /home/ # for PHP logs
    [email protected]:~# mkdir /home/ # for your web page
    [email protected]:~# mkdir /home/ # for temp
    [email protected]:~# mkdir /home/ # for sessions
    [email protected]:~# chown -R user001:group001 /home/
    6. Add to pool for your domain and edit it
    [email protected]:~# cp /etc/php5/fpm/pool.d/www.conf /etc/php5/fpm/pool.d/
    [email protected]:~# nano /etc/php5/fpm/pool.d/
    ; pool name ('www' here)
    ; Unix user/group of processes
    user = user001
    group = group001
    ; The address on which to accept FastCGI requests.
    listen = /var/run/
    ; Set permissions for unix socket, if one is used. In Linux, read/write
    listen.owner = user001 = group001
    listen.mode = 0666
    ; Default Value: nothing is defined by default except the values in php.ini ...
    ; add php.ini admin values
    php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f [email protected]
    php_flag[display_errors] = off
    php_admin_value[error_log] = /home/
    php_admin_flag[log_errors] = on
    php_admin_value[upload_tmp_dir] = /home/
    php_admin_value[session.save_path] = /home/
    php_admin_value[open_basedir] = /home/
    php_admin_value[mail.log] = /home/
    php_admin_value[memory_limit] = 64M
    php_admin_value[post_max_size] = 18M
    php_admin_value[max_execution_time] = 60
    php_admin_value[allow_url_fopen] = Off
    php_admin_value[upload_max_filesize] = 18M
    php_admin_value[date.timezone] = Europe/Moscow