{"id":436,"date":"2023-02-25T12:28:43","date_gmt":"2023-02-25T04:28:43","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=436"},"modified":"2023-04-29T21:05:04","modified_gmt":"2023-04-29T13:05:04","slug":"homestead-precautions","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/25\/homestead-precautions\/","title":{"rendered":"Homestead\u6ce8\u610f\u95ee\u9898"},"content":{"rendered":"<h2>Homestead.yaml \u76ee\u5f55<\/h2>\n<p>\u67e5\u770bVagrantfile<\/p>\n<pre><code>\/\/\u4ee3\u8868\u5728\u5f53\u524d\u76ee\u5f55\u4e0b\nconfDir = $confDir ||= File.expand_path(File.dirname(__FILE__))<\/code><\/pre>\n<p><!-- more --><\/p>\n<pre><code>\/\/\u4ee3\u8868\u5728\u7528\u6237\u76ee\u5f55\u4e0b\nconfDir = $confDir ||= File.expand_path(File.join(Dir.home, &quot;.homestead&quot;))<\/code><\/pre>\n<h2>Homestead \u540d\u79f0<\/h2>\n<p>\u4fee\u6539scripts\/homestead.rb\uff0c\u6ce8\u610f4\u5904\u5730\u65b9<\/p>\n<pre><code class=\"language-ruby\">config.vm.define settings[&quot;name&quot;] ||= &quot;homestead-7&quot;\n...\nconfig.vm.provider &quot;virtualbox&quot; do |vb|\n      vb.name = settings[&quot;name&quot;] ||= &quot;homestead-7&quot;\n...\nconfig.vm.provider vmware do |v|\n      v.vmx[&quot;displayName&quot;] = settings[&quot;name&quot;] ||= &quot;homestead-7&quot;\n...\nconfig.vm.provider &quot;parallels&quot; do |v|\n      v.name = settings[&quot;name&quot;] ||= &quot;homestead-7&quot;<\/code><\/pre>\n<h2>\u7f51\u7edc\u914d\u7f6e<\/h2>\n<h3>\u79c1\u6709\u7f51\u7edc<\/h3>\n<pre><code>192.168.10.10   yz.app\n192.168.10.10   homestead.app<\/code><\/pre>\n<p>SSH\u8fde\u63a5\uff1a<\/p>\n<ul>\n<li>SSH address: 127.0.0.1:2222 \u6216 192.168.10.10:22<\/li>\n<li>SSH username: vagrant<\/li>\n<li>SSH password: vagrant<\/li>\n<\/ul>\n<pre><code class=\"language-yaml\">ip: &quot;192.168.10.10&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<h3>\u516c\u5171\u7f51\u7edc<\/h3>\n<h4>\u901a\u8fc7\u4fee\u6539homestead.rb<\/h4>\n<p>scripts\/homestead.rb<\/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>Homestead.yaml<\/p>\n<pre><code>192.168.10.10   yz.app\n192.168.10.10   homestead.app\n192.168.1.222   ye.app<\/code><\/pre>\n<blockquote>\n<p>\u6ce8\u610f\uff1a\u5bbf\u4e3b\u673a\u901a\u8fc7yz.app\u4e0d\u80fd\u8bbf\u95ee\uff0c\u901a\u8fc7ye.app\u4e0d\u80fd\u8bbf\u95ee\uff1b\u5c40\u57df\u7f51\u5185\u5176\u4ed6\u673a\u5668\u8bbe\u7f6ehosts\u901a\u8fc7ye.app\u53ef\u4ee5\u8bbf\u95ee<\/p>\n<\/blockquote>\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<p>SSH\u8fde\u63a5\uff1a<\/p>\n<ul>\n<li>SSH address: 127.0.0.1:2222 \u6216 192.168.1.222:22<\/li>\n<li>SSH username: vagrant<\/li>\n<li>SSH password: vagrant<\/li>\n<\/ul>\n<h4>\u76f4\u63a5\u4fee\u6539Homestead.yaml<\/h4>\n<pre><code>192.168.10.10   yz.app\n192.168.10.10   homestead.app\n192.168.1.222   ye.app<\/code><\/pre>\n<blockquote>\n<p>\u6ce8\u610f\uff1a\u5bbf\u4e3b\u673a\u901a\u8fc7yz.app\u53ef\u4ee5\u8bbf\u95ee\uff0c\u901a\u8fc7ye.app\u4e0d\u80fd\u8bbf\u95ee\uff1b\u5c40\u57df\u7f51\u5185\u5176\u4ed6\u673a\u5668\u8bbe\u7f6ehosts\u901a\u8fc7ye.app\u53ef\u4ee5\u8bbf\u95ee<\/p>\n<\/blockquote>\n<pre><code class=\"language-yaml\">networks:\n    - type: &quot;public_network&quot;\n      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    - map: ye.app\n      to: \/home\/vagrant\/www\/yezhou\/public\n\ndatabases:\n    - homestead<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Homestead.yaml \u76ee\u5f55 \u67e5\u770bVagrantfile \/\/\u4ee3\u8868\u5728\u5f53\u524d\u76ee\u5f55\u4e0b confDir = $c [&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-436","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\/436","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=436"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/436\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}