debian: การติดตั้งให้เรียกใช้งานเว็บเซิร์ฟเวอร์ภายในจากภายนอก
Submitted by wd on Fri, 2009-01-23 08:40
debian: lenny/etch
package: apache2.2 (2.2.9-10+lenny1/2.2.3-4+etch6)
สมมุติว่าเซิร์ฟเวอร์ภายนอก ชื่อ www.example.com มีการติดตั้ง apache2 ไว้แล้ว
และเซิร์ฟเวอร์ภายใน ชื่อ internal.example.com มีการติดตั้ง apache2 ไว้แล้ว
ทำที่เครื่องเซิร์ฟเวอร์ภายนอกอย่างเดียว โดยใช้มอดูล proxy_http
# a2enmod proxy
# a2enmod proxy_http
# /etc/init.d/apache2 restart
ติดตั้งชื่อไฟล์ไซต์ใน sites-available ว่า internal
# vi /etc/apache2/sites-available/internal
<VirtualHost *:80>
ServerAdmin webmaster@internal.example.com
ServerName internal.example.com
ProxyRequests Off
<Proxy *>
Order Deny,Allow
Allow from all
</Proxy>
ProxyPreserveHost On
ProxyPass / http://internal.example.com/
ProxyPassReverse / http://internal.example.com/
</VirtualHost>
เปิดใช้งาน
# a2ensite internal
# /etc/init.d/apache2 reload
เสร็จแล้ว
ถ้าเราตั้งค่า dns ของภายนอกไว้แล้ว สามารถเรียกจากภายนอกผ่าน internal.example.com
- Printer-friendly version
- Log in or register to post comments
- 3331 reads







Recent comments