{"id":435,"date":"2023-02-25T12:27:47","date_gmt":"2023-02-25T04:27:47","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=435"},"modified":"2023-04-29T21:05:15","modified_gmt":"2023-04-29T13:05:15","slug":"homestead-lan-access","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/25\/homestead-lan-access\/","title":{"rendered":"Homestead\u5c40\u57df\u7f51\u8bbf\u95ee"},"content":{"rendered":"<p>Laravel Homestead \u662f\u4e00\u4e2a\u5b98\u65b9\u9884\u8f7d\u7684 Vagrant\u300c\u5c01\u88c5\u5305\u300d\uff0c\u63d0\u4f9b\u4f60\u4e00\u4e2a\u7f8e\u597d\u7684\u5f00\u53d1\u73af\u5883\uff0c\u4f60\u4e0d\u9700\u8981\u5728\u4f60\u7684\u672c\u673a\u7aef\u5b89\u88c5 PHP\u3001HHVM\u3001\u7f51\u9875\u670d\u52a1\u5668\u6216\u4efb\u4f55\u670d\u52a1\u5668\u8f6f\u4ef6\u3002<\/p>\n<p>Vagrant\u4e00\u5171\u6709\u4e09\u79cd\u7f51\u7edc\u914d\u7f6e\uff1a<\/p>\n<ul>\n<li>Forwarded port\uff1a\u7aef\u53e3\u8f6c\u53d1\u7684\u65b9\u5f0f<\/li>\n<li>Private network\uff1a\u79c1\u6709\u7f51\u7edc\uff0c\u53ea\u6709\u5bbf\u4e3b\u673a\u53ef\u4ee5\u8bbf\u95ee\u865a\u62df\u673a<\/li>\n<li>Public network\uff1a\u4e0e\u5bbf\u4e3b\u673a\u5668\u4e00\u6837\u7684\u7f51\u7edc\u914d\u7f6e\uff0c\u53ea\u8981\u4f60\u80fd\u8bbf\u95ee\u5230\u5bbf\u4e3b\u673a\uff0c\u5c31\u80fd\u8bbf\u95ee\u5230\u865a\u62df\u673a<\/li>\n<\/ul>\n<p><!-- more --><\/p>\n<p>\u6709\u65f6\u5019\u6211\u4eec\u5e0c\u671b\u5728\u5c40\u57df\u7f51\u5185\u8bbf\u95ee\u53e6\u4e00\u53f0\u4e3b\u673a\u4e0a\u7684\u865a\u62df\u673a\uff0c\u6240\u4ee5\u9700\u8981\u914d\u7f6epublic network\u7c7b\u578b\u7684\u7f51\u7edc\uff0c<\/p>\n<p>\uff081\uff09\u5728Homestead\u4e2d\u53ea\u9700\u8981\u4fee\u6539<code>Homestead\\scripts\\homestead.rb<\/code>\u6587\u4ef6\uff0c\u5c06<code>config.vm.network :private_network<\/code>\u4fee\u6539\u4e3a<code>public_network<\/code><\/p>\n<pre><code class=\"language-ruby\"># config.vm.network :private_network, ip: settings[&quot;ip&quot;] ||= &quot;192.168.10.10&quot;\nconfig.vm.network :public_network, ip: settings[&quot;ip&quot;] ||= &quot;192.168.10.10&quot;<\/code><\/pre>\n<p>\uff082\uff09<code>~\/.homestead\/Homestead.yaml<\/code>\u7684ip\u5b57\u6bb5\u914d\u7f6e\u6210\u4e00\u4e2a\u548c\u4f60\u4e3b\u673a\u540c\u4e00\u7f51\u6bb5\u7684ip<\/p>\n<pre><code class=\"language-yaml\">ip: &quot;192.168.1.222&quot;\nmemory: 2048\ncpus: 1\nprovider: virtualbox\n\nauthorize: ~\/.ssh\/id_rsa.pub\n\nkeys:\n    - ~\/.ssh\/id_rsa\n\nfolders:\n    - map: D:\/Laravel\/www\n      to: \/home\/vagrant\/www\n\nsites:\n    - map: homestead.app\n      to: \/home\/vagrant\/www\/index\n    - map: yz.app\n      to: \/home\/vagrant\/www\/yezhou\/public\n\ndatabases:\n    - homestead<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Laravel Homestead \u662f\u4e00\u4e2a\u5b98\u65b9\u9884\u8f7d\u7684 Vagrant\u300c\u5c01\u88c5\u5305\u300d\uff0c\u63d0\u4f9b\u4f60\u4e00\u4e2a\u7f8e\u597d\u7684\u5f00\u53d1\u73af\u5883\uff0c\u4f60\u4e0d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[140],"class_list":["post-435","post","type-post","status-publish","format-standard","hentry","category-laravel","tag-homestead"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/435","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=435"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/435\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}