{"id":448,"date":"2013-11-25T17:55:30","date_gmt":"2013-11-25T17:55:30","guid":{"rendered":"http:\/\/blog.shineservers.com\/?p=448"},"modified":"2013-11-25T17:55:30","modified_gmt":"2013-11-25T17:55:30","slug":"using-two-ips-bind-lighttpd-virtual-hosting","status":"publish","type":"post","link":"https:\/\/www.shineservers.com\/2013\/11\/25\/using-two-ips-bind-lighttpd-virtual-hosting\/","title":{"rendered":"Using More Than Two IPs (bind) In Lighttpd For Virtual Hosting"},"content":{"rendered":"<p>Virtual hosting is nothing but the provision of Web server hosting services so that a company (or individual) doesn&#8217;t have to purchase and maintain its own Web server and connections to the Internet.<\/p>\n<p>Lighttpd does support or allows you to bind more than two IP address simultaneously using\u00a0<strong>$SERVER[&#8220;socket&#8221;].<\/strong>.<\/p>\n<p>For example,<br \/>\nIP # 1:\u00a0<strong>192.168.1.1<\/strong>\u00a0domain\u00a0domain.com<br \/>\nIP # 2:\u00a0<strong>192.168.1.2<\/strong>\u00a0domain\u00a0domain2.com<\/p>\n<p>Open lighttpd.conf file:<br \/>\n<code># vi \/etc\/lighttpd\/lighttpd.conf<\/code><\/p>\n<p>First use server.bind and server.port to setup 192.168.1.1 IP<br \/>\n<code>server.port = 80<br \/>\nserver.bind = \"192.168.1.1\"<\/code><\/p>\n<p>Now define domain.com\u00a0virtual host:<br \/>\n<code>$HTTP[\"host\"] == \"www.domain.com\" {<br \/>\nserver.document-root = \"\/home\/lighttpd\/domain.com\/http\"<br \/>\nserver.errorlog = \"\/var\/log\/lighttpd\/domain.com\/error.log\"<br \/>\naccesslog.filename = \"\/var\/log\/lighttpd\/domain.com\/access.log\"<br \/>\n}<\/code><\/p>\n<p>Next use $SERVER[&#8220;socket&#8221;] to bind 192.168.1.2:80 for domain2.com\u00a0domain:<br \/>\n<code>$SERVER[\"socket\"] == \"192.168.1.2:80\" {<br \/>\nserver.document-root = \"\/home\/lighttpd\/domain2.com\/http\"<br \/>\nserver.errorlog = \"\/var\/log\/lighttpd\/domain2.com\/error.log\"<br \/>\naccesslog.filename = \"\/var\/log\/lighttpd\/domain2.com\/access.log\"<br \/>\n}<\/code><\/p>\n<p>Save and close config file. Restart the lighttpd:<br \/>\n<code># \/etc\/init.d\/lighttpd restart<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Virtual hosting is nothing but the provision of Web server hosting services so that a company (or individual) doesn&#8217;t have to purchase and maintain its own Web server and connections to the Internet. Lighttpd does support or allows you to bind more than two IP address simultaneously using\u00a0$SERVER[&#8220;socket&#8221;].. For example, IP # 1:\u00a0192.168.1.1\u00a0domain\u00a0domain.com IP # [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[60],"tags":[160],"class_list":["post-448","post","type-post","status-publish","format-standard","hentry","category-linux","tag-using-more-than-two-ips-bind-in-lighttpd-for-virtual-hosting"],"acf":[],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/posts\/448","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/comments?post=448"}],"version-history":[{"count":0,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/posts\/448\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/media?parent=448"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/categories?post=448"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/tags?post=448"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}