{"id":511,"date":"2010-05-30T21:23:25","date_gmt":"2010-05-30T18:23:25","guid":{"rendered":"http:\/\/seriyps.ru\/blog\/?p=511"},"modified":"2010-06-22T12:28:08","modified_gmt":"2010-06-22T09:28:08","slug":"basic-http-avtorizaciya-dlya-nginx","status":"publish","type":"post","link":"https:\/\/seriyps.com\/blog\/2010\/05\/30\/basic-http-avtorizaciya-dlya-nginx\/","title":{"rendered":"Basic HTTP \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u043b\u044f Nginx"},"content":{"rendered":"<p>\u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u044d\u0442\u043e \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f <a href=\"http:\/\/sysoev.ru\/nginx\/docs\/http\/ngx_http_auth_basic_module.html\" target=\"_blank\">\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a Nginx<\/a>, \u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0435\u0442 \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c htpasswd \u0444\u0430\u0439\u043b, \u043f\u0440\u0438\u0447\u0435\u043c \u0432 \u0441\u0430\u043c\u043e\u043c Nginx \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0434\u043b\u044f \u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u0435\u0442 (\u0438 \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e), \u043d\u043e \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0443 htpasswd\u00a0 \u0432\u0445\u043e\u0434\u044f\u0449\u0443\u044e \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 Apache. <span style=\"color: #808080;\">\u0427\u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u0441\u043c\u0435\u0448\u043d\u043e\u0435, \u043d\u0430 \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445, \u0433\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f Nginx, \u0430\u043f\u0430\u0447\u0430 \u043d\u0435\u0442 \u0438 \u043d\u0435 \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u043e\u0432, &#8220;\u043f\u043e\u0437\u043d\u0430\u0432\u0448\u0438\u0445&#8221; \u0434\u043b\u044f \u0441\u0435\u0431\u044f Nginx \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442 \u043d\u0435\u0441\u043a\u0440\u044b\u0432\u0430\u0435\u043c\u043e \u043d\u0435\u0434\u043e\u043b\u044e\u0431\u043b\u0438\u0432\u0430\u0442\u044c \u0430\u043f\u0430\u0447 \u0438 \u0432\u0435\u0440\u044f\u0442, \u0447\u0442\u043e \u043d\u0430\u0441\u0442\u0443\u043f\u0438\u0442 \u0442\u043e\u0442 \u0447\u0430\u0441, \u043a\u043e\u0433\u0434\u0430 \u0434\u043b\u044f Nginx \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u0441\u0434\u0435\u043b\u0430\u044e\u0442 \u0430\u043d\u0430\u043b\u043e\u0433 htaccess \u0438 \u0430\u043f\u0430\u0447, \u0438\u0441\u043f\u0440\u0430\u0432\u043d\u043e \u0441\u043b\u0443\u0436\u0438\u0432\u0448\u0438\u0439 \u0438\u043c \u0434\u043e\u043b\u0433\u0438\u0435 \u0433\u043e\u0434\u044b, \u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u0441\u0433\u0438\u043d\u0435\u0442 \u0432 \u043d\u0435\u0431\u044b\u0442\u0438\u0435.<\/span> \u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0439 \u0434\u043e\u0441\u0430\u0434\u043d\u044b\u0439 \u0444\u0430\u043a\u0442, \u0434\u043e\u0431\u0430\u0432\u043b\u044e \u0432 \u0441\u0442\u0430\u0442\u044c\u044e \u043e\u043d\u043b\u0430\u0439\u043d-\u0444\u043e\u0440\u043c\u043e\u0447\u043a\u0443 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 htpasswd \u0444\u0439\u043b\u0430.<br \/>\n<!--more--><br \/>\n\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0434\u0434\u043e\u043c\u0435\u043d \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u043f\u043e \u043b\u043e\u0433\u0438\u043d\u0443\/\u043f\u0430\u0440\u043e\u043b\u044e \u0438 \u0432 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0432 \u043d\u0435\u0439\u00a0 \u0431\u0443\u0434\u0443\u0442 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043f\u0430\u0440\u0430 \u043b\u043e\u0433\u0438\u043d\/\u043f\u0430\u0440\u043e\u043b\u044c \u0438 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u0441 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c \u043b\u0438\u0441\u0442\u0438\u043d\u0433\u043e\u043c \u0444\u0430\u0439\u043b\u043e\u0432 \u0442\u043e\u0436\u0435 \u0441 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c. \u0422.\u0435. \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0430\u044f:<br \/>\n\/ (\u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0444\u0430\u0439\u043b\u0430\u043c \u043f\u043e _\u043b\u043e\u0433\u0438\u043d-\u043f\u0430\u0440\u043e\u043b\u044c_1)<br \/>\n&#8211;otherpass\/ (\u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0444\u0430\u0439\u043b\u0430\u043c \u043f\u043e _\u043b\u043e\u0433\u0438\u043d-\u043f\u0430\u0440\u043e\u043b\u044c_2)<br \/>\n&#8211;listed\/ (\u0432\u043a\u043b\u044e\u0447\u0435\u043d \u0430\u0432\u0442\u043e\u0438\u043d\u0434\u0435\u043a\u0441 \u0444\u0430\u0439\u043b\u043e\u0432, \u0442.\u0435. \u043c\u043e\u0436\u043d\u0433\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u0430\u043a\u0438\u0435 \u0444\u0430\u0439\u043b\u044b \u0442\u0443\u0442 \u043b\u0435\u0436\u0430\u0442, \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0444\u0430\u0439\u043b\u0430\u043c \u043f\u043e _\u043b\u043e\u0433\u0438\u043d-\u043f\u0430\u0440\u043e\u043b\u044c_3)<\/p>\n<h2>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u0445\u043e\u0441\u0442 Nginx<\/h2>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u043e\u043c\u0435\u043d\u0430 adminka.example.com. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">sudo nano \/etc\/nginx\/sites-available\/adminka.example.com<\/pre>\n<p>\u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:<\/p>\n<pre>server {\r\n\tlisten   80;\r\n\tserver_name  adminka.example.com;\r\n\taccess_log  \/var\/log\/nginx\/adminka_example_com.log;#\u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \/var\/log\/nginx\/$host.log \u043d\u043e \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043b\u043e\u0433-\u0444\u0430\u0439\u043b \u0438 \u0432\u044b\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u043d\u0435\u0433\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0430\r\n\troot   \/var\/www\/$host\/htdocs;\r\n\tindex  index.html index.htm index.php;\r\n}<\/pre>\n<p>\u041e\u043a, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c, \u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e\u0442 \u0445\u043e\u0441\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c (\u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433 \u043d\u0434\u0436\u0438\u043d\u043a\u0441\u0430):<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">sudo ln -s \/etc\/nginx\/sites-available\/adminka.example.com \/etc\/nginx\/sites-enabled\/adminka.example.com<\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0434\u043b\u044f htdocs<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">mkdir \/var\/www\/{adminka.example.com,adminka.example.com\/htdocs,adminka.example.com\/htdocs\/{otherpass,listed}<\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043a\u0442\u043e \u043d\u0435 \u043f\u043e\u043d\u044f\u043b, \u044d\u0442\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0434\u0435\u043b\u0430\u0435\u0442 \u0442\u043e \u0436\u0435, \u0447\u0442\u043e \u0438 4 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">mkdir \/var\/www\/adminka.example.com\r\nmkdir \/var\/www\/adminka.example.com\/htdocs\r\nmkdir \/var\/www\/adminka.example.com\/htdocs\/otherpass\r\nmkdir \/var\/www\/adminka.example.com\/htdocs\/listed<\/pre>\n<p>\u0420\u0435\u0441\u0442\u0430\u0440\u0442\u0438\u043c Nginx<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">sudo service nginx configtest\r\nsudo service nginx restart<\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c: <a href=\"http:\/\/adminka.example.com\/\">http:\/\/adminka.example.com\/<\/a><br \/>\n\u0410\u0433\u0430<\/p>\n<blockquote><p>403 Forbidden<br \/>\nnginx\/0.7.64<\/p><\/blockquote>\n<p>\u041f\u0430\u0440\u043e\u043b\u0438 \u043d\u0435 \u043f\u0440\u043e\u0441\u0438\u0442, \u043b\u0438\u0441\u0442\u0438\u043d\u0433 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0443 \u043d\u0430\u0441 \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d \u0438 index \u0444\u0430\u0439\u043b\u0430 \u043c\u044b \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0438. \u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0434\u043b\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0439  otherpass \u0438 listed. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c 403 \u043e\u0448\u0438\u0431\u043a\u0443 &#8220;\u0434\u043e\u0441\u0442\u0443\u043f \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d&#8221;.<\/p>\n<h2>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043b\u0438\u0441\u0442\u0438\u043d\u0433 (\u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u0435\u043d)<\/h2>\n<p>\u041c\u044b \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438\u0441\u044c, \u0447\u0442\u043e \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 listed \u0443 \u043d\u0430\u0441 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438&#8230; \u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">sudo nano \/etc\/nginx\/sites-available\/adminka.example.com<\/pre>\n<pre>server {\r\n<span style=\"color: #808080;\">\tlisten   80;\r\n\tserver_name  adminka.example.com;\r\n\taccess_log  \/var\/log\/nginx\/adminka_example_com.log;\r\n\troot   \/var\/www\/$host\/htdocs;\r\n\tindex  index.html index.htm index.php;<\/span>\r\n\tlocation \/listed\/ {\r\n\t\tautoindex on;\r\n\t}\r\n}<\/pre>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c, \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c, \u043f\u0440\u043e\u0431\u0443\u0435\u043c: <a href=\"http:\/\/adminka.example.com\/\">http:\/\/adminka.example.com\/listed\/<\/a><br \/>\n\u0410\u0433\u0430, \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n<blockquote><p>Index of \/listed\/<br \/>\n_________<br \/>\n..\/<br \/>\n_________<\/p><\/blockquote>\n<p>\u041d\u043e \u0433\u0434\u0435 \u0436\u0435 \u043e\u0431\u0435\u0449\u0430\u043d\u043d\u044b\u0435 \u043f\u0430\u0440\u043e\u043b\u0438? \u0421\u043f\u043e\u043a\u043e\u0439\u043d\u043e, \u0441\u0435\u0439\u0447\u0430\u0441 \u0432\u0441\u0435 \u0431\u0443\u0434\u0435\u0442!<\/p>\n<h2>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c Basic HTTP authorization.<\/h2>\n<p>\u041f\u0430\u0440\u043e\u043b\u0438 \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0439 \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 htpasswd \u0444\u0430\u0439\u043b\u0430\u0445 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 htdocs. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a:<\/p>\n<pre>\/var\/www\/adminka.example.com\/\r\n--\/root_htpasswd\r\n--\/listed_htpasswd\r\n--\/otherpass_htpasswd<\/pre>\n<pre>server {\r\n<span style=\"color: #808080;\">\tlisten   80;\r\n\tserver_name  adminka.example.com;\r\n\taccess_log  \/var\/log\/nginx\/adminka_example_com.log;\r\n\troot   \/var\/www\/$host\/htdocs;\r\n\tindex  index.html index.htm index.php;<\/span>\r\n\tlocation \/ {\r\n\t\tauth_basic \"Unauthorized\"; # \u0442\u0435\u043a\u0441\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0432\u0432\u0435\u0441\u0442\u0438 \u043f\u0430\u0440\u043e\u043b\u044c\r\n\t\tauth_basic_user_file \/var\/www\/$host\/root_htpasswd; # \u043f\u0443\u0442\u044c \u043a htpasswd \u0444\u0430\u0439\u043b\u0443\r\n\t}\r\n\tlocation \/listed\/ {\r\n\t\tauth_basic \"Unauthorized\";\r\n\t\tauth_basic_user_file \/var\/www\/$host\/listed_htpasswd;\r\n\t\tautoindex on;\r\n\t}\r\n\tlocation \/otherpass\/ {\r\n\t\tauth_basic \"Unauthorized\";\r\n\t\tauth_basic_user_file \/var\/www\/$host\/otherpass_htpasswd;\r\n\t\tautoindex on;\r\n\t}\r\n}<\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c htpasswd \u0444\u0430\u0439\u043b\u044b (\u0441\u043c. \u0434\u0430\u043b\u0435\u0435), \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c, \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c!<\/p>\n<h2>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0445\u0435\u0448\u0430 \u043f\u0430\u0440\u043e\u043b\u044f<\/h2>\n<p>HTTP \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0432 Nginx \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a \u0436\u0435 \u043a\u0430\u043a \u0438 \u0432 Apache, \u0442.\u0435. \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c htpasswd \u0444\u0430\u0439\u043b\u0430, \u043d\u043e \u0441 \u0442\u0435\u043c \u043b\u0438\u0448\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435\u043c, \u0447\u0442\u043e \u0434\u043b\u044f \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u0440\u043e\u043b\u044f \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c DES \u0441 \u0434\u0432\u0443\u0445\u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u0441\u043e\u043b\u044c\u044e. \u0412 Linux \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f C-\u0444\u0443\u043d\u043a\u0446\u0438\u044f crypt() (\u0441\u043c <code>man 3 crypt<\/code>).<\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0442\u0438\u043b\u0438\u0442\u0443 htpasswd \u0438\u0437 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0438 Apache<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">htpasswd -nd seriy\r\nNew password:\r\nRe-type new password:<\/pre>\n<pre>seriy:4lQ0JcanrGr9E<\/pre>\n<p>\u0412\u044b\u0432\u043e\u0434 \u044d\u0442\u043e\u0439 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 3-\u0445 \u0447\u0430\u0441\u0442\u0435\u0439: \u043f\u0435\u0440\u0432\u0430\u044f, \u0434\u043e \u0434\u0432\u043e\u0435\u0442\u043e\u0447\u0438\u044f &#8220;seriy&#8221; &#8211; \u044d\u0442\u043e \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, &#8220;4l&#8221; &#8211; \u044d\u0442\u043e \u0434\u0432\u0443\u0445\u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u0430\u044f \u0441\u043e\u043b\u044c \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 crypt() \u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c &#8220;Q0JcanrGr9E&#8221; &#8211; \u044d\u0442\u043e \u0441\u0430\u043c \u0445\u0435\u0448 \u043f\u0430\u0440\u043e\u043b\u044f. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 &#8211; \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c apache.<\/p>\n<p>\u0412\u043e\u0442 \u043f\u0430\u0440\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 htpasswd (<strong>your_password<\/strong> &#8211; \u0432\u0430\u0448 \u043f\u0430\u0440\u043e\u043b\u044c, <strong>salt<\/strong> &#8211; \u0441\u043e\u043b\u044c \u0434\u043b\u044f \u043f\u0430\u0440\u043e\u043b\u044f, \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c 2(!!!) \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u0438\u0437 \u043d\u0430\u0431\u043e\u0440\u0430 &#8220;.\/0-9A-Za-z&#8221;):<br \/>\n\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f php:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">php -r 'echo crypt(&quot;your_password&quot;, &quot;salt&quot;);'<\/pre>\n<p>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Python:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">python -c 'import crypt; print crypt.crypt(&quot;your_password&quot;, &quot;salt&quot;)'<\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043a\u0442\u043e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 &#8211; (perl, ruby) \u0431\u0443\u0434\u0443 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u0435\u043d. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0442\u0438\u043b\u0438\u0442\u0443 mcrypt \u043d\u043e \u044f \u0432 \u043d\u0435\u0439 \u043d\u0435 \u0441\u043c\u043e\u0433 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>\u0412 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 &#8211; \u0432\u043e\u0442 <a href=\"http:\/\/seriyps.ru\/crypt\/htpasswd\/\">\u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0430\u044f \u0432\u0435\u0431-\u0444\u043e\u0440\u043c\u043e\u0447\u043a\u0430 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 htpasswd<\/a> \u043e\u043d\u043b\u0430\u0439\u043d.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u044d\u0442\u043e \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a Nginx, \u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0435\u0442 \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c htpasswd \u0444\u0430\u0439\u043b, \u043f\u0440\u0438\u0447\u0435\u043c \u0432 \u0441\u0430\u043c\u043e\u043c Nginx \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0434\u043b\u044f \u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u0435\u0442 (\u0438 \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e), \u043d\u043e \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0443 htpasswd\u00a0 \u0432\u0445\u043e\u0434\u044f\u0449\u0443\u044e \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 Apache. \u0427\u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u0441\u043c\u0435\u0448\u043d\u043e\u0435, \u043d\u0430 \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445, \u0433\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f Nginx, \u0430\u043f\u0430\u0447\u0430 \u043d\u0435\u0442 \u0438 \u043d\u0435 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[154,158,152,151,134,153],"class_list":["post-511","post","type-post","status-publish","format-standard","hentry","category-linux","tag-authorization","tag-crypt","tag-htpasswd","tag-http","tag-nginx","tag-virtualxost"],"_links":{"self":[{"href":"https:\/\/seriyps.com\/blog\/wp-json\/wp\/v2\/posts\/511","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/seriyps.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/seriyps.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/seriyps.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/seriyps.com\/blog\/wp-json\/wp\/v2\/comments?post=511"}],"version-history":[{"count":10,"href":"https:\/\/seriyps.com\/blog\/wp-json\/wp\/v2\/posts\/511\/revisions"}],"predecessor-version":[{"id":545,"href":"https:\/\/seriyps.com\/blog\/wp-json\/wp\/v2\/posts\/511\/revisions\/545"}],"wp:attachment":[{"href":"https:\/\/seriyps.com\/blog\/wp-json\/wp\/v2\/media?parent=511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seriyps.com\/blog\/wp-json\/wp\/v2\/categories?post=511"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seriyps.com\/blog\/wp-json\/wp\/v2\/tags?post=511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}