lost and found ( for me ? )

Apache: IP-based Virtual Host

# httpd -v | head -1
Server version: Apache/2.2.3

192.168.100.1 , 192.168.100.3

- httpd.conf for IP-based Virtual Host

-- start --

# Listen 80

#
# ServerName www1.example.com
# DocumentRoot /var/www/html/www1
#



#
# ServerName www3.example.com
# DocumentRoot /var/www/html/www3
#


-- end --

ServerAdmin , ErrorLog , TransferLog ディレクティブを省略すると
デフォルト値が適用される。

# mkdir /var/www/html/www1
# mkdir /var/www/html/www3

# echo "www1" > /var/www/html/www1/index.html
# echo "www3" > /var/www/html/www3/index.html

# /etc/init.d/httpd start

- telnet で確認

# telnet 192.168.100.1 80
Trying 192.168.100.1...
Connected to 192.168.100.1 (192.168.100.1).
Escape character is '^]'.
GET / HTTP/1.0

HTTP/1.1 200 OK
Server: Apache/2.2.3 (CentOS)
ETag: "64e6c5-5-9bd2c780"
Accept-Ranges: bytes
Content-Length: 5
Connection: close
Content-Type: text/html; charset=UTF-8

www1 <- OK
Connection closed by foreign host.
#

# telnet 192.168.100.3 80
Trying 192.168.100.3...
Connected to 192.168.100.3 (192.168.100.3).
Escape character is '^]'.
GET / HTTP/1.0

HTTP/1.1 200 OK
Server: Apache/2.2.3 (CentOS)
ETag: "64e6c6-5-9c3d9740"
Accept-Ranges: bytes
Content-Length: 5
Connection: close
Content-Type: text/html; charset=UTF-8

www3 <- OK
Connection closed by foreign host.
#

get things done.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.