Skip to content

Commit cd8ee4a

Browse files
committed
update hell-vagrant.md again
1 parent 8c3f5cb commit cd8ee4a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/content/blog/hello-vagrant.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ config.vm.provision "shell", name: "install-dependencies", path: "./install-depe
8686
เราสามารถ set IP ของ VM และสามารถ access ผ่านเหมือนมี server อยู่ในวง LAN เราได้เลย
8787

8888
```rb
89-
nginx.vm.network "private_network", ip: '192.168.56.11' # Visit http://192.168.56.11:8082
89+
nginx.vm.network "private_network", ip: '192.168.56.11'
9090
```
9191

9292
ส่วน Forward Port ตรงนี้จะ Tricky หน่อย
@@ -95,9 +95,13 @@ nginx.vm.network "private_network", ip: '192.168.56.11' # Visit http://192.168.5
9595
nginx.vm.network "forwarded_port", guest: 80, host: 8082
9696
```
9797

98-
`guest: 80` คิดเหมือนว่าเป็น docker expose port
98+
`guest: 80` คือพอร์ตใน VM
9999

100-
`host: 8082` คล้ายๆ map docker container expose port ไปที่ physical host และเข้าผ่าน IP ที่ตั้งไว้ได้ `http://192.168.56.11:8082`
100+
`host: 8082` คือพอร์ตบนเครื่อง host ที่ forward ไปยัง VM:80
101+
102+
เข้าได้ผ่าน `http://localhost:8082` (หรือ IP ของเครื่อง host)
103+
104+
ถ้าจะเข้าโดยใช้ IP ของ VM `192.168.56.11` ให้ใช้ `http://192.168.56.11:80` (ไม่ใช่ `:8082`)
101105

102106
<br>
103107

0 commit comments

Comments
 (0)