{"id":772,"date":"2019-09-06T11:58:59","date_gmt":"2019-09-06T08:58:59","guid":{"rendered":"https:\/\/blog.airmeno.ru\/?p=772"},"modified":"2019-09-06T12:02:55","modified_gmt":"2019-09-06T09:02:55","slug":"web-server-na-nginx","status":"publish","type":"post","link":"https:\/\/blog.airmeno.ru\/?p=772","title":{"rendered":"WEB \u0421\u0435\u0440\u0432\u0435\u0440 \u043d\u0430 Nginx"},"content":{"rendered":"\n<p>NGINX + PHP + MySQL (Debian 9)<\/p>\n\n\n\n<p>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u0432\u0435\u0431 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430 \u0441\u0432\u044f\u0437\u043a\u0435 Nginx &#8212; PHP (\u0432\u0435\u0440\u0441\u0438\u0438 7.3 \u0438 5.6) &#8212; MySQL (MariaDB) &#8212; phpMyAdmin \u043d\u0430 Linux Debian 9.x. \u0412\u0435\u0440\u0441\u0438\u0439 PHP \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438 \u0431\u043e\u043b\u044c\u0448\u0435. \u042d\u0442\u043e \u043d\u0430 \u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0438.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>1. \u0421\u0442\u0430\u0432\u0438\u043c MySQL (MariaDB):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get install mariadb-server mariadb-client mariadb-common<\/code><\/pre>\n\n\n\n<p>\u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql_secure_installation <\/code><\/pre>\n\n\n\n<p>2. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 (\u0432 Debain 9 \u043d\u0435\u0442 PHP 7.3 \u0438 PHP 5.6).<\/p>\n\n\n\n<p>\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get install apt-transport-https lsb-release ca-certificates<\/code><\/pre>\n\n\n\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u043b\u044e\u0447 gpg:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget -O \/etc\/apt\/trusted.gpg.d\/php.gpg https:\/\/packages.sury.org\/php\/apt.gpg<\/code><\/pre>\n\n\n\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0432 \u0441\u0432\u043e\u0438 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \"deb https:\/\/packages.sury.org\/php\/ $(lsb_release -sc) main\" > \/etc\/apt\/sources.list.d\/php.list<\/code><\/pre>\n\n\n\n<p>\u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u043f\u0430\u043a\u0435\u0442\u044b:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get update<\/code><\/pre>\n\n\n\n<p>3. \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c NGINX:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get install nginx\nsystemctl enable nginx\nsystemctl start nginx<\/code><\/pre>\n\n\n\n<p>4. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 PHP \u0438 PHP-FPM:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get install php7.3 php7.3-fpm php7.3-mysql<\/code><\/pre>\n\n\n\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c PHP \u043a Nginx:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nano \/etc\/nginx\/sites-enabled\/default<\/code><\/pre>\n\n\n\n<p>\u0412 \u0441\u0435\u043a\u0446\u0438\u0438 location:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>location \/ {\n    index index.php index.html index.htm;\n}<\/code><\/pre>\n\n\n\n<p>\u0412 \u0441\u0435\u043a\u0446\u0438\u0438 server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>location ~ .php$ {\n     set $root_path \/var\/www\/html;\n     fastcgi_pass unix:\/run\/php\/php7.3-fpm.sock;\n     fastcgi_index index.php;\n     fastcgi_param SCRIPT_FILENAME $root_path$fastcgi_script_name;\n     include fastcgi_params;\n     fastcgi_param DOCUMENT_ROOT $root_path;\n }<\/code><\/pre>\n\n\n\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nginx -t\nsystemctl restart nginx<\/code><\/pre>\n\n\n\n<p>5. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 phpMyAdmin:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get install phpmyadmin<\/code><\/pre>\n\n\n\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0430\u043b\u0438\u0430\u0441 \u0434\u043b\u044f phpmyadmin:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ln -s \/usr\/share\/phpmyadmin \/var\/www\/html\/webtool<\/code><\/pre>\n\n\n\n<p>\u0422\u0435\u043f\u0435\u0440\u044c phpMyAdmin \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 &#8212; https:\/\/\u0432\u0430\u0448_\u0445\u043e\u0441\u0442\/webtool\/ <\/p>\n\n\n\n<p>6. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0445\u043e\u0441\u0442:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nano \/etc\/nginx\/sites-available\/airmeno.ru\n\nserver {\n        listen       80;\n        server_name  www.airmeno.ru airmeno.ru;\n        set $root_path \/var\/www\/airmeno.ru;\n\nroot $root_path;\n    location \/ {\n        try_files  $uri $uri\/ \/index.php;\n        index index.php;\n    }\n    location ~ \\.php$ {\n        fastcgi_pass unix:\/run\/php\/php7.3-fpm.sock;\n        fastcgi_index index.php;\n        fastcgi_param SCRIPT_FILENAME $root_path$fastcgi_script_name;\n        include fastcgi_params;\n        fastcgi_param DOCUMENT_ROOT $root_path;\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u0432 sites-enabled \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c Nginx:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ln -s \/etc\/nginx\/sites-available\/airmeno.ru \/etc\/nginx\/sites-enabled\/airmeno\nsystemctl reload nginx<\/code><\/pre>\n\n\n\n<p>7. \u0421\u0442\u0430\u0432\u0438\u043c \u0432\u0435\u0440\u0441\u0438\u044e PHP 5.6 \u0434\u043b\u044f \u0441\u0442\u0430\u0440\u044b\u0445 \u0441\u0430\u0439\u0442\u043e\u0432:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get install php5.6 php5.6-fpm php5.6-cgi php5.6-mysql<\/code><\/pre>\n\n\n\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \u0438 \u0432\u0435\u0440\u0441\u0438\u044e \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>update-alternatives --config php<\/code><\/pre>\n\n\n\n<p>\u0412\u0435\u0440\u0441\u0438\u044e PHP \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445 \u0441\u0442\u0440\u043e\u0447\u043a\u0438:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>location ~ .php$ {\n            fastcgi_pass unix:\/run\/php\/php7.3-fpm.sock;\n        }\n\n\u0414\u043b\u044f 7.3 - php7.3-fpm.sock\n\u0434\u043b\u044f 5.6 - php5.6-fpm.sock<\/code><\/pre>\n\n\n\n<p>\u041e\u0448\u0438\u0431\u043a\u0430 \u0432 phpMyAdmin (PHP 7.3 + Debian 9)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Warning in .\/libraries\/plugin_interface.lib.php#551 count(): Parameter must be an array or an object that implements Countable<\/code><\/pre>\n\n\n\n<p>\u0418\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f:<\/p>\n\n\n\n<p>\u0432 \u0444\u0430\u0439\u043b\u0435 \/usr\/share\/phpmyadmin\/libraries\/sql.lib.php:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u0441\u0442\u0440\u043e\u043a\u0443\n|| (count($analyzed_sql_results['select_expr'] == 1)\n\u043d\u0430\n|| ((count($analyzed_sql_results['select_expr']) == 1)<\/code><\/pre>\n\n\n\n<p>\u0432 \u0444\u0430\u0439\u043b\u0435 \/usr\/share\/phpmyadmin\/libraries\/plugin_interface.lib.php:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u0441\u0442\u0440\u043e\u043a\u0443\nif ($options != null &amp;&amp; count($options) > 0) {\n\u043d\u0430\nif ($options != null &amp;&amp; count((array) $options) > 0) {<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>NGINX + PHP + MySQL (Debian 9) \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u0432\u0435\u0431 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430 \u0441\u0432\u044f\u0437\u043a\u0435 Nginx &#8212; PHP (\u0432\u0435\u0440\u0441\u0438\u0438 7.3 \u0438 5.6) &#8212; MySQL (MariaDB) &#8212; phpMyAdmin \u043d\u0430&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[12,15,85,48],"_links":{"self":[{"href":"https:\/\/blog.airmeno.ru\/index.php?rest_route=\/wp\/v2\/posts\/772"}],"collection":[{"href":"https:\/\/blog.airmeno.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.airmeno.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.airmeno.ru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.airmeno.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=772"}],"version-history":[{"count":3,"href":"https:\/\/blog.airmeno.ru\/index.php?rest_route=\/wp\/v2\/posts\/772\/revisions"}],"predecessor-version":[{"id":775,"href":"https:\/\/blog.airmeno.ru\/index.php?rest_route=\/wp\/v2\/posts\/772\/revisions\/775"}],"wp:attachment":[{"href":"https:\/\/blog.airmeno.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=772"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.airmeno.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=772"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.airmeno.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}