{"id":109,"date":"2018-09-06T13:30:30","date_gmt":"2018-09-06T13:30:30","guid":{"rendered":"http:\/\/www.vetais.com\/ru\/wiki\/?p=109"},"modified":"2018-10-28T16:40:24","modified_gmt":"2018-10-28T16:40:24","slug":"vetais-allow-database-connect-from-internet-local-network","status":"publish","type":"post","link":"https:\/\/www.vetais.com\/ru\/wiki\/2018\/09\/06\/vetais-allow-database-connect-from-internet-local-network\/","title":{"rendered":"VetAIS &#8212; allow database connect from Internet\/local network"},"content":{"rendered":"<p>PostgreSQL server have in most cases allowed connection from localhost only.<br \/>\nNetwork connection are not permitted. If you are interested to allow any network connection, it can be from another local LAN network or also from Internet, you need to edit configuration of PostgreSQL.<\/p>\n<p>Note: for Internet access you probably need to configure your router or another device you use for internet access on side where is database!<\/p>\n<p>PostgreSQL configuration of access is stored in file &#171;<em>pg_hba.conf<\/em>&#171;, on Windows systems is stored in &#171;<em>c:\\vetais_data\\<\/em>&#171;.<\/p>\n<p>Here, on the end of file you can see list of IP or network segments allowed to connect. For example here is part of configuration that allowed localhost only.<\/p>\n<div><strong># TYPE\u00a0 DATABASE\u00a0 \u00a0 \u00a0 \u00a0 USER\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 ADDRESS\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0METHOD<\/strong><\/div>\n<div><\/div>\n<div><strong># IPv4 local connections:<\/strong><\/div>\n<div><strong>host\u00a0 \u00a0 all\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0all\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0127.0.0.1\/32\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 md5<\/strong><\/div>\n<p>For allow connect local network for example with segment 192.168.1.0\/24 add this line:<\/p>\n<div><strong>host\u00a0 \u00a0 all\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0all\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0192.168.1.0\/24\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 md5<\/strong><\/div>\n<p>If you are interested to allow remote IP via Internet access, you need first to check your remote IP (for example to open on client! PC site <a href=\"http:\/\/www.myip.dk\">www.myip.dk<\/a>). On this page you will see, for example IP 1.2.3.4.<br \/>\nThen add this line into configuration:<\/p>\n<div>\n<div><strong>host\u00a0 \u00a0 all\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0all\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a01.2.3.4\/32\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 md5<\/strong><\/div>\n<\/div>\n<p>Please, always restart PostgreSQL server to make changes valid.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PostgreSQL server have in most cases allowed connection from localhost only. Network connection are not permitted. If you are interested to allow any network connection, it can be from another local LAN network or also from Internet, you need to edit configuration of PostgreSQL. Note: for Internet access you probably need to configure your router or another device you use for internet access on side where is database! PostgreSQL configuration of access is stored in [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[],"class_list":["post-109","post","type-post","status-publish","format-standard","hentry","category-it-"],"_links":{"self":[{"href":"https:\/\/www.vetais.com\/ru\/wiki\/wp-json\/wp\/v2\/posts\/109","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vetais.com\/ru\/wiki\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vetais.com\/ru\/wiki\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vetais.com\/ru\/wiki\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vetais.com\/ru\/wiki\/wp-json\/wp\/v2\/comments?post=109"}],"version-history":[{"count":1,"href":"https:\/\/www.vetais.com\/ru\/wiki\/wp-json\/wp\/v2\/posts\/109\/revisions"}],"predecessor-version":[{"id":110,"href":"https:\/\/www.vetais.com\/ru\/wiki\/wp-json\/wp\/v2\/posts\/109\/revisions\/110"}],"wp:attachment":[{"href":"https:\/\/www.vetais.com\/ru\/wiki\/wp-json\/wp\/v2\/media?parent=109"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vetais.com\/ru\/wiki\/wp-json\/wp\/v2\/categories?post=109"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vetais.com\/ru\/wiki\/wp-json\/wp\/v2\/tags?post=109"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}