{"id":394,"date":"2011-10-06T19:33:00","date_gmt":"2011-10-06T19:33:00","guid":{"rendered":"http:\/\/blog.successionua.com\/?p=394"},"modified":"2011-10-06T19:33:00","modified_gmt":"2011-10-06T19:33:00","slug":"%d0%bd%d0%b0%d1%81%d1%82%d1%80%d0%be%d0%b9%d0%ba%d0%b0-mass-virtual-hosting-%d0%b4%d0%bb%d1%8f-apache-linux","status":"publish","type":"post","link":"https:\/\/geckich.space\/?p=394","title":{"rendered":"\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 mass virtual hosting \u0434\u043b\u044f Apache (Linux)"},"content":{"rendered":"<div dir=\"ltr\" style=\"text-align: left;\">\u0412 \u043e\u0431\u0449\u0435\u043c, \u0438\u0434\u0435\u044f \u043c\u0430\u0441\u0441 \u0432\u0438\u0440\u0442\u0443\u0430\u043b \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u0430\u043f\u043e\u0447\u043a\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u043c\u044b \u0432 \u043d\u0435\u0439 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043e\u0434\u043f\u0430\u043f\u043a\u0443 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u0432 \u0432\u0438\u0434\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0430\u0439\u0442\u0430 &#8211; \u0438 \u0432\u0441\u0451, \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0445\u043e\u0441\u0442 \u0433\u043e\u0442\u043e\u0432, \u043d\u0435 \u043d\u0430\u0434\u043e \u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0438\u043a\u0430\u043a\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0438 \u0438 \u0442. \u0434. \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0430\u043f\u043a\u0430 \u0434\u043b\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b \u0445\u043e\u0441\u0442\u043e\u0432 \u0431\u044b\u043b\u0430&nbsp;\/srv\/http\/vhosts, \u0437\u0430\u0442\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0430\u0439\u0442\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 site1.example.int, \u0430 \u0432\u0441\u044f \u043d\u0430\u0447\u0438\u043d\u043a\u0430 \u0432 \u043f\u043e\u0434\u043f\u0430\u043f\u043a\u0435 \u0441\u0430\u0439\u0442\u0430&nbsp;public. \u0422. \u0435. \u0437\u0430\u0433\u043b\u0430\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441\u0430\u0439\u0442\u0430:&nbsp;\/srv\/http\/vhosts\/site1.example.int\/public\/index.php<\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043a\u043e\u043d\u0435\u0446 \u043a\u043e\u043d\u0444\u0438\u0433\u0430 \u0430\u043f\u0430\u0447\u0430 (httpd.conf) \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p><span style=\"color: #e69138; font-family: 'Courier New', Courier, monospace;\"><b>RewriteEngine On<\/b><\/span><br \/><span style=\"color: #e69138; font-family: 'Courier New', Courier, monospace;\"><b>## Create a handle to convert upper or mixed-case to lower-case<\/b><\/span><br \/><span style=\"color: #e69138; font-family: 'Courier New', Courier, monospace;\"><b>RewriteMap lowercase int:tolower<\/b><\/span><br \/><span style=\"color: #e69138; font-family: 'Courier New', Courier, monospace;\"><b><br \/><\/b><\/span><br \/><span style=\"color: #e69138; font-family: 'Courier New', Courier, monospace;\"><b>##&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/b><\/span><br \/><span style=\"color: #e69138; font-family: 'Courier New', Courier, monospace;\"><b>## where hostname has www prefix<\/b><\/span><br \/><span style=\"color: #e69138; font-family: 'Courier New', Courier, monospace;\"><b>##&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/b><\/span><br \/><span style=\"color: #e69138; font-family: 'Courier New', Courier, monospace;\"><b>## Firstly create custom variable that contains the host without the www prefix<\/b><\/span><br \/><span style=\"color: #e69138; font-family: 'Courier New', Courier, monospace;\"><b>RewriteCond %{HTTP_HOST} ^www.(.*)$<\/b><\/span><br \/><span style=\"color: #e69138; font-family: 'Courier New', Courier, monospace;\"><b>RewriteRule .? &#8211; [E=noWWWHost:%1]<\/b><\/span><br \/><span style=\"font-family: 'Courier New', Courier, monospace;\"><b><\/b><\/span><br \/><a name='more'><\/a><span style=\"font-family: 'Courier New', Courier, monospace;\"><b><br \/><\/b><\/span><br \/><span style=\"color: #e69138; font-family: 'Courier New', Courier, monospace;\"><b>## Map the virtualhost to the documentroot<\/b><\/span><br \/><span style=\"color: #e69138; font-family: 'Courier New', Courier, monospace;\"><b>RewriteCond %{REQUEST_URI} !^\/~<\/b><\/span><br \/><span style=\"color: #e69138; font-family: 'Courier New', Courier, monospace;\"><b>RewriteCond %{HTTP_HOST} ^www.<\/b><\/span><br \/><span style=\"color: #e69138; font-family: 'Courier New', Courier, monospace;\"><b>RewriteRule ^\/(.*)$ \/home\/vhosts\/${lowercase:%{ENV:noWWWHost}}\/public_html\/$1<\/b><\/span><br \/><span style=\"color: #e69138; font-family: 'Courier New', Courier, monospace;\"><b>##&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/b><\/span><br \/><span style=\"color: #e69138; font-family: 'Courier New', Courier, monospace;\"><b>## where hostname *does not* have www prefix<\/b><\/span><br \/><span style=\"color: #e69138; font-family: 'Courier New', Courier, monospace;\"><b>##&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/b><\/span><br \/><span style=\"color: #e69138; font-family: 'Courier New', Courier, monospace;\"><b>## Map the virtualhost to the documentroot<\/b><\/span><br \/><span style=\"color: #e69138; font-family: 'Courier New', Courier, monospace;\"><b>RewriteCond %{REQUEST_URI} !^\/~<\/b><\/span><br \/><span style=\"color: #e69138; font-family: 'Courier New', Courier, monospace;\"><b>RewriteCond %{HTTP_HOST} !^www.<\/b><\/span><br \/><span style=\"color: #e69138; font-family: 'Courier New', Courier, monospace;\"><b>RewriteRule ^\/(.*)$ \/srv\/http\/vhosts\/${lowercase:%{HTTP_HOST}}\/public\/$1<\/b><\/span><\/p>\n<div><\/div>\n<div>\u041f\u043e\u0434\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0432 \u0440\u0435\u0433\u044d\u043a\u0441\u043f\u044b \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043f\u0443\u0442\u044c \u043a \u043f\u0430\u043f\u043a\u0435 \u0441 \u0432\u0438\u0440\u0442. \u0445\u043e\u0441\u0442\u0430\u043c\u0438.<\/div>\n<\/div>\n<div>http:\/\/geckich.blogspot.com\/<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u0412 \u043e\u0431\u0449\u0435\u043c, \u0438\u0434\u0435\u044f \u043c\u0430\u0441\u0441 \u0432\u0438\u0440\u0442\u0443\u0430\u043b \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u0430\u043f\u043e\u0447\u043a\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u043c\u044b \u0432 \u043d\u0435\u0439 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043e\u0434\u043f\u0430\u043f\u043a\u0443 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u0432 \u0432\u0438\u0434\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0430\u0439\u0442\u0430 &#8211; \u0438 \u0432\u0441\u0451, \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0445\u043e\u0441\u0442 \u0433\u043e\u0442\u043e\u0432, \u043d\u0435 \u043d\u0430\u0434\u043e \u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0438\u043a\u0430\u043a\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0438 \u0438 \u0442. \u0434. \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0430\u043f\u043a\u0430 \u0434\u043b\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b \u0445\u043e\u0441\u0442\u043e\u0432 \u0431\u044b\u043b\u0430&nbsp;\/srv\/http\/vhosts, \u0437\u0430\u0442\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0430\u0439\u0442\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 site1.example.int, &hellip; <a href=\"https:\/\/geckich.space\/?p=394\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 mass virtual hosting \u0434\u043b\u044f Apache (Linux)<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[10],"tags":[],"class_list":["post-394","post","type-post","status-publish","format-standard","hentry","category-linux"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/geckich.space\/index.php?rest_route=\/wp\/v2\/posts\/394","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geckich.space\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geckich.space\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geckich.space\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/geckich.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=394"}],"version-history":[{"count":0,"href":"https:\/\/geckich.space\/index.php?rest_route=\/wp\/v2\/posts\/394\/revisions"}],"wp:attachment":[{"href":"https:\/\/geckich.space\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=394"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geckich.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=394"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geckich.space\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}