아파치 기본캐릭터셋 설정 AddDefaultCharset

1 개요[ | ]

아파치 기본캐릭터셋 설정
아파치 DefaultCharset 설정
아파치 AddDefaultCharset 지시자
  • html에 캐릭터셋이 정의되지 않았을 경우에 적용되는 기본캐릭터셋을 지정하는 아파치 지시자

2 예시: CentOS[ | ]

실제 동작 확인
[root@zetawiki ~]# echo hello > /var/www/html/greet.html
[root@zetawiki ~]# curl -s -I http://localhost/greet.html
HTTP/1.1 200 OK
Date: Fri, 02 Oct 2015 06:35:15 GMT
Server: Apache
Last-Modified: Fri, 02 Oct 2015 06:35:07 GMT
ETag: "20629-6-521195d569e52"
Accept-Ranges: bytes
Content-Length: 6
Connection: close
Content-Type: text/html; charset=UTF-8
→ 파일내용에는 "hello" 밖에 없지만, 캐릭터셋은 UTF-8로 나옴
설정 파일 확인
[root@zetawiki ~]# grep DefaultCharset /etc/httpd/conf/httpd.conf
AddDefaultCharset UTF-8
→ 기본캐릭터셋이 UTF-8로 설정되어 있음

3 예시: 우분투[ | ]

실제 동작 확인
root@zetawiki:~# echo hello > /var/www/html/greet.html
root@zetawiki:~# curl -s -I http://localhost/greet.html
HTTP/1.1 200 OK
Date: Fri, 02 Oct 2015 06:35:15 GMT
Server: Apache
Last-Modified: Fri, 02 Oct 2015 06:35:07 GMT
ETag: "6-521195d548626"
Accept-Ranges: bytes
Content-Length: 6
Content-Type: text/html
→ 헤더에 캐릭터셋 정보 없음
설정 파일 확인
root@zetawiki:~# grep DefaultCharset /etc/apache2/conf-enabled/charset.conf
# Read the documentation before enabling AddDefaultCharset.
#AddDefaultCharset UTF-8
→ 주석처리되어 있음

4 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}