{"id":2511,"date":"2017-11-02T07:47:48","date_gmt":"2017-11-02T07:47:48","guid":{"rendered":"https:\/\/tst-amo.pp.ua\/blog\/?p=2511"},"modified":"2017-11-02T08:13:09","modified_gmt":"2017-11-02T08:13:09","slug":"nginx-mysql-php-lemp-%d0%b2-ubuntu","status":"publish","type":"post","link":"https:\/\/tst-amo.net.ua\/blog\/?p=2511","title":{"rendered":"Nginx, MySQL, PHP (LEMP) \u0432 Ubuntu"},"content":{"rendered":"<h4>NGINX<\/h4>\n<pre>$ sudo apt-get update\r\n$ sudo apt-get install nginx<\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c:<\/p>\n<pre>http:\/\/192.168.0.1<\/pre>\n<p>\u0414\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c:<\/p>\n<pre>Welcome to nginx!\r\nIf you see this page, the nginx web server is successfully installed and \r\nworking. Further configuration is required.\r\nFor online documentation and support please refer to\u00a0<a href=\"http:\/\/nginx.org\/\">nginx.org<\/a>.\r\nCommercial support is available at\u00a0<a href=\"http:\/\/nginx.com\/\">nginx.com<\/a>.\r\n<em>Thank you for using nginx.<\/em><\/pre>\n<h4>MySQL<\/h4>\n<pre>apt install mysql-server<\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c<\/p>\n<pre>mysql_secure_installation<\/pre>\n<p>\u043f\u043b\u0430\u0433\u0438\u043d VALIDATE PASSWORD PLUGIN \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c, \u0430 \u043d\u0430 \u0432\u0441\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c <em>Y<\/em> &#8211; \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0443\u0434\u0430\u043b\u044f\u0442\u0441\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0431\u0430\u0437\u044b \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438, \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 \u0432\u0445\u043e\u0434 \u0434\u043b\u044f \u0440\u0443\u0442\u0430.<\/p>\n<h4>PHP-FPM<\/h4>\n<pre>apt install php-fpm php-mysql<\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 PHP \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0438\u0445 \u0434\u043b\u044f \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<p>\u041e\u0442\u043a\u0440\u043e\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b\u00a0<code>php-fpm<\/code>\u00a0\u0441 \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u044f\u043c\u0438 root:<\/p>\n<pre>sudo nano \/etc\/php\/7.0\/fpm\/php.ini<\/pre>\n<p>\u041d\u0430\u0439\u0434\u0451\u043c \u0432 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u00a0<code>cgi.fix_pathinfo<\/code>. \u041e\u043d \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0442\u043e\u0447\u043a\u043e\u0439 \u0441 \u0437\u0430\u043f\u044f\u0442\u043e\u0439 (;) \u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 &#8220;<em>1<\/em>&#8221; \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n<p>\u042d\u0442\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0438\u043c PHP \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0439 \u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c\u044b\u0439 PHP \u0444\u0430\u0439\u043b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u0439\u0434\u0435\u043d. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c PHP \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u044b, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0443 \u043d\u0438\u0445 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430.<\/p>\n<p>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0440\u0430\u0441\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0432 \u044d\u0442\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0432 \u0435\u0451 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 &#8220;<em>0<\/em>&#8220;.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c<\/p>\n<pre>systemctl restart php7.1-fpm<\/pre>\n<h4 id=\"\u0428\u0430\u0433-4-\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430-nginx-\u0434\u043b\u044f-\u0440\u0430\u0431\u043e\u0442\u044b-\u0441-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c-php\">\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Nginx \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 PHP-FPM<\/h4>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043c Nginx \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 PHP \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430.<\/p>\n<p>\u041c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432 (\u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0430\u043d\u0430\u043b\u043e\u0433\u043e\u043c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u0445\u043e\u0441\u0442\u043e\u0432 \u0432 Apache). \u041e\u0442\u043a\u0440\u043e\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0439 \u0431\u043b\u043e\u043a Nginx \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e:<\/p>\n<pre>sudo nano \/etc\/nginx\/sites-available\/default\r\n\r\nserver {\r\n\u00a0 \u00a0 \u00a0 \u00a0 listen 80 default_server;\r\n\u00a0 \u00a0 \u00a0 \u00a0 listen [::]:80 default_server;\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 root \/var\/www\/html;\r\n\u00a0 \u00a0 \u00a0 \u00a0 index <span style=\"color: #ff0000;\">index.php<\/span> index.html index.htm index.nginx-debian.html;\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 server_name <span style=\"color: #ff0000;\">192.168.0.1<\/span>;\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 location \/ {\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 try_files $uri $uri\/ =404;\r\n\u00a0 \u00a0 \u00a0 \u00a0 }\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 <span style=\"color: #ff0000;\">location ~ \\.php$ {<\/span>\r\n<span style=\"color: #ff0000;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0include snippets\/fastcgi-php.conf;<\/span>\r\n<span style=\"color: #ff0000;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0fastcgi_pass unix:\/run\/php\/php7.0-fpm.sock;<\/span>\r\n<span style=\"color: #ff0000;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0}<\/span>\r\n\r\n<span style=\"color: #ff0000;\">\u00a0 \u00a0 \u00a0 \u00a0 location ~ \/\\.ht {<\/span>\r\n<span style=\"color: #ff0000;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 deny all;<\/span>\r\n<span style=\"color: #ff0000;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0}<\/span>\r\n}<\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0432\u0430\u0448 \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043e\u0448\u0438\u0431\u043e\u043a \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre>sudo nginx -t<\/pre>\n<p>\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c<\/p>\n<pre>sudo systemctl reload nginx<\/pre>\n<h4>\u041f\u0420\u041e\u0412\u0415\u0420\u041a\u0410<\/h4>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b\u0438\u043a<\/p>\n<pre>sudo nano \/var\/www\/html\/info.php\r\n\r\n&lt;?php\r\n\u00a0 \u00a0 \u00a0phpinfo();\r\n?&gt;<\/pre>\n<p>\u0418 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430\u0431\u0440\u0430\u0432 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435:<\/p>\n<pre>http:\/\/\u0434\u043e\u043c\u0435\u043d_\u0438\u043b\u0438_IP_\u0430\u0434\u0440\u0435\u0441_\u0441\u0435\u0440\u0432\u0435\u0440\u0430\/info.php<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<div class=\"pdfprnt-buttons pdfprnt-buttons-post pdfprnt-bottom-right\"><a href=\"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=wpv2posts2511&print=pdf\" class=\"pdfprnt-button pdfprnt-button-pdf\" target=\"_blank\"><img decoding=\"async\" src=\"https:\/\/tst-amo.net.ua\/blog\/wp-content\/plugins\/pdf-print\/images\/pdf.png\" alt=\"image_pdf\" title=\"View PDF\" \/><\/a><a href=\"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=wpv2posts2511&print=print\" class=\"pdfprnt-button pdfprnt-button-print\" target=\"_blank\"><img decoding=\"async\" src=\"https:\/\/tst-amo.net.ua\/blog\/wp-content\/plugins\/pdf-print\/images\/print.png\" alt=\"image_print\" title=\"Print Content\" \/><\/a><\/div>","protected":false},"excerpt":{"rendered":"<p>NGINX $ sudo apt-get update $ sudo apt-get install nginx \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c: http:\/\/192.168.0.1 \u0414\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c: Welcome to nginx! If you see this page, the nginx web server is successfully installed and working. Further configuration is required. For online documentation and support please refer to\u00a0nginx.org. Commercial support is available at\u00a0nginx.com. Thank you for using nginx. MySQL apt &#8230;<\/p>\n<p><a href=\"https:\/\/tst-amo.net.ua\/blog\/?p=2511\" class=\"more-link\">Continue reading &lsquo;Nginx, MySQL, PHP (LEMP) \u0432 Ubuntu&rsquo; &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[98,47,99,100],"tags":[],"class_list":["post-2511","post","type-post","status-publish","format-standard","hentry","category-lemp","category-linux","category-nginx","category-php-fpm"],"_links":{"self":[{"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2511"}],"collection":[{"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2511"}],"version-history":[{"count":7,"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2511\/revisions"}],"predecessor-version":[{"id":2518,"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2511\/revisions\/2518"}],"wp:attachment":[{"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2511"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}