- 2014.12.24
[문제]
웹 기본경로 : /export/home/main/public_html 기존에 설정한 내용들 모두 삭제 후 진행
- 조건
host : ns, www
domain : hatms.com
user : main
skel : /sam/
auto creating directory : public_html
ip : 192.168.1.24
index : main.html
hdd : 1G, SCSI : 100, 200, 200, 300, 200
automount, nfs, autofs 설정 partition : 300M - main 계정 생성
ip 변경
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
5 IPADDR=192.168.1.24
8 DNS1=192.168.1.24
11 DOMAIN=hatms.com
1G SCSI HDD 추가, fdisk, mkfs 진행
=> 이전 실습 문서 참조
기존 samadal 계정 $HOME = /home/samadal 로 이동
# usermod -d /home/samadal samadal
# mv /export/home/samadal/ /home/
nfs, autofs 관련 PKG 설치 및 실행
=> 설치 되어 있음
# /etc/rc.d/init.d/nfs restart
# chkconfig nfs on
# /etc/rc.d/init.d/autofs restart
# chkfonfig autofs on
nfs export 설정, server측 automount 설정
# mkdir /sdb
# cd /sdb/
# mkdir 1 2 3 5 6
# vi /etc/fstab
19 /dev/sdb1 /sdb/1 ext4 defaults 1 2
20 /dev/sdb2 /sdb/2 ext4 defaults 1 2
21 /dev/sdb3 /sdb/3 ext4 defaults 1 2
22 /dev/sdb5 /sdb/5 ext4 defaults 1 2
23 /dev/sdb6 /sdb/6 ext4 defaults 1 2
# mount -a
# vi /etc/exports
1 /sdb/1 192.168.1.0/24(rw,no_root_squash,sync)
2 /sdb/2 192.168.1.0/24(rw,no_root_squash,sync)
3 /sdb/3 192.168.1.0/24(rw,no_root_squash,sync)
4 /sdb/5 192.168.1.0/24(rw,no_root_squash,sync)
5 /sdb/6 192.168.1.0/24(rw,no_root_squash,sync)
# exportfs -ra
# exportfs -v
nfs 방화벽 오픈
# system-config-firewall
=> NFS4 체크
client측 automount : 100, 200, 300(/export/home)
# vi /etc/fstab
24 192.168.1.24:/sdb/1 /nfs_client/1 nfs defaults 1 2
25 192.168.1.24:/sdb/2 /nfs_client/2 nfs defaults 1 2
26 192.168.1.24:/sdb/5 /export/home nfs defaults 1 2
autofs : 200, 200
# vi /etc/autofs.conf
38 browse_mode = yes
# vi /etc/auto.misc
16 sdb3 -rw,hard,intr 192.16 8.1.24:/sdb/3
17 sdb6 -rw,hard,intr 192.16 8.1.24:/sdb/6
auto creating directory & skel 생성
# cp -r /etc/skel/ /sam/
# mkdir /sam/public_html
main 계정 생성
# useradd -d /export/home/main -m -k /sam main
tip) autofs 로 300M 마운트 하는 방법
# vi /etc/auto.master
7 /export /etc/auto.misc
# vi /etc/auto.misc
18 home -rw,hard,intr 192.16 8.1.24:/sdb/5
# /etc/rc.d/init.d/autofs restart
# useradd -d /export/home/main -m -k /sam main
DNS & Web 설정
# vi /etc/named.rfc1912.zones
43 zone "hatms.com" IN {
44 type master;
45 file "ha.z";
46 allow-update { none; };
47 };
48
49 zone "1.168.192.in-addr.arpa" IN {
50 type master;
51 file "ha.r";
52 allow-update { none; };
53 };
# vi /var/named/ha.z
1 $TTL 1D
2 @ IN SOA ns.hatms.com. root.hat ms.com(
3 2014122401
4 3H
5 15M
6 1W
7 1D)
8 IN NS ns.hatms.com.
9 IN A 192.168.1.24
10 ns IN A 192.168.1.24
11 www IN A 192.168.1.24
# vi /var/named/ha.r
1 $TTL 1D
2 @ IN SOA ns.hatms.com. root.hat ms.com(
3 2014122301
4 3H
5 15M
6 1W
7 1D)
8 IN NS ns.hatms.com.
9 IN A 192.168.1.145
10 24 IN PTR ns.hatms.com.
11 24 IN PTR www.hatms.com.
# chmod 660 /var/named/ha*
# chown .named /var/named/ha*
# vi /etc/httpd/conf/httpd.conf
262 ServerAdmin root@hatms.com
277 ServerName www.hatms.com:80
293 DocumentRoot "/export/home/main/public_html"
403 DirectoryIndex index.html index.php index.html .var main.html
# vi /export/home/main/public_html/main.html
1 <html>
2 <head></head>
3 <body><H1>main page</H1></body>
4 </html>
# chmod 701 /export/home/main/
# /etc/rc.d/init.d/httpd restart
# chkfonfig httpd on
[문제]
www.hatms.com
www.hatms.com/user1
두개의 내용이 다르게 뜨도록 설정
# cd ~main/public_html/
# mkdir user1
# cp ./main.html ./user1/
[ Apache_Alias ]
# vi /etc/httpd/conf/httpd.conf
552 Alias /icons/ "/var/www/icons/"
553 Alias /0g "/gongG/"
# /etc/rc.d/init.d/httd restart
# mkdir /gongG/
# cat > /gongG/index.html
<cetner><H1> gong~~~ gong~~~ </H1></center>
아래 페이지들 접속하여 확인해보기.
www.hatms.com/0g
www.hatms.com/icons
=> Alias 뒤 디렉터리에 / 붙이면 꼭 / 까지 붙여야 접속이 되고 / 안붙이면 /를 안붙여도 접속이 된다.
'Study > CentOS' 카테고리의 다른 글
[37] mysql(2), mysql password 분실 시 대처 방법, myphpadmin(1) (0) | 2015.04.06 |
---|---|
[36] Apache_VirtualHosts, user directory, mysql(1) (0) | 2015.04.06 |
[34] Apache (0) | 2015.04.06 |
[33] DNS 실습, static ip 설정, interface 이름 변경 (0) | 2015.04.06 |
[32] DNS 실습 with VNC (0) | 2015.04.06 |