NGINX + PHP FastCGI

Создать для PHP FastCGI настройки для сайта (/etc/php-fpm.d/phpmyadmin.conf):

[phpmyadmin]
user = apache
group = apache
listen = 127.0.0.1:9001
;listen = 37.230.116.128:9001
listen.allowed_clients = 127.0.0.1

pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
slowlog = /var/www/logs/slowlog.log
chdir = /var/www/phpmyadmin

php_admin_value[mbstring.func_overload] = 0
php_admin_value[error_log] = /var/www/logs/php-errors.log
php_admin_value[mbstring.internal_encoding] = UTF-8

php_admin_flag[log_errors] = on

php_value[max_input_vars] = 10000
php_value[upload_max_filesize] = 4M
php_value[post_max_size] = 6M

php_value[session.save_handler] = files
php_value[session.save_path] = /var/www/session
php_value[soap.wsdl_cache_dir]  = /var/www/wsdlcache
php_value[opcache.revalidate_freq] = 0
php_value[display_errors] = On
php_value[error_reporting] = E_ALL
php_value[session.use_cookies] = 1
php_value[session.use_only_cookies] = 1

 

Файл настроек NGINX (/etc/nginx/nginx.conf):

user apache;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    include /etc/nginx/conf.d/*.conf;

    server {
        listen       8443 ssl http2 default_server;
        listen       [::]:8443 ssl http2 default_server;
        server_name  _;
        root         /var/www/phpmyadmin;
		index index.php;
		
		try_files $uri $uri/ /index.php?$query_string;

        ssl_certificate "/etc/pki/tls/certs/localhost.crt";
        ssl_certificate_key "/etc/pki/tls/private/localhost.key";
        ssl_session_cache shared:SSL:1m;
        ssl_session_timeout  10m;
        ssl_ciphers PROFILE=SYSTEM;
        ssl_prefer_server_ciphers on;
		
		location ~ \.php$ {
			include fastcgi_params;
			fastcgi_split_path_info ^(.+\.php)(/.+)$;
			fastcgi_pass 127.0.0.1:9001;
			fastcgi_index index.php;
			fastcgi_param SCRIPT_FILENAME $request_filename;
			fastcgi_param QUERY_STRING    $query_string;
			fastcgi_param REQUEST_METHOD  $request_method;
			fastcgi_param CONTENT_TYPE    $content_type;
			fastcgi_param CONTENT_LENGTH  $content_length;
		}
		
        include /etc/nginx/default.d/*.conf;

        location / {
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }

}