"우분투 아파치 기본캐릭터셋 UTF-8 설정"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
 
(사용자 2명의 중간 판 16개는 보이지 않습니다)
1번째 줄: 1번째 줄:
==개요==
{{다른뜻|CentOS 아파치 기본캐릭터셋 UTF-8 설정}}
{{테스트|Ubuntu 14, Apache 2.4}}
;아파치 기본캐릭터셋 UTF-8 설정
;아파치 기본캐릭터셋 UTF-8 설정
;아파치 AddDefaultCharset UTF-8


==확인==
==확인==
;실제 동작 확인
;실제 동작 확인
<source lang='cli'>
<syntaxhighlight lang='console'>
root@zetawiki:~# echo hello > /var/www/html/greet.html
root@zetawiki:~# echo hello > /var/www/html/greet.html
root@zetawiki:~# curl -s -I http://localhost/greet.html
root@zetawiki:~# curl -s -I http://localhost/greet.html
15번째 줄: 17번째 줄:
Content-Length: 6
Content-Length: 6
Content-Type: text/html
Content-Type: text/html
</source>
</syntaxhighlight>
:→ 헤더에 캐릭터셋 정보 없음
:→ 헤더에 캐릭터셋 정보 없음


;설정 파일 확인
;설정 파일 확인
<source lang='cli'>
<syntaxhighlight lang='console'>
root@zetawiki:~# grep DefaultCharset /etc/apache2/conf-enabled/charset.conf
root@zetawiki:~# grep DefaultCharset /etc/apache2/conf-enabled/charset.conf
# Read the documentation before enabling AddDefaultCharset.
# Read the documentation before enabling AddDefaultCharset.
#AddDefaultCharset UTF-8
#AddDefaultCharset UTF-8
</source>
</syntaxhighlight>
:→ 주석처리되어 있음
:→ 주석처리되어 있음


==charset.conf 수정==
==charset.conf 수정==
*/etc/apache2/conf-enabled/charset.conf 파일에 있는 UTF-8 설정 주석 해제
*/etc/apache2/conf-enabled/charset.conf 파일에 있는 UTF-8 설정 주석 해제
<source lang='cli'>
<syntaxhighlight lang='console'>
root@zetawiki:~# vi /etc/apache2/conf-enabled/charset.conf
root@zetawiki:~# vi /etc/apache2/conf-enabled/charset.conf
</source>
</syntaxhighlight>
<source lang='autoconf' highlight='6'>
<syntaxhighlight lang='apacheconf' highlight='6'>
# Read the documentation before enabling AddDefaultCharset.
# Read the documentation before enabling AddDefaultCharset.
# In general, it is only a good idea if you know that all your files
# In general, it is only a good idea if you know that all your files
40번째 줄: 42번째 줄:


# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
</source>
</syntaxhighlight>
 
==아파치 재시작==
<syntaxhighlight lang='console'>
root@zetawiki:~# /etc/init.d/apache2 restart
* Restarting web server apache2                                                              [ OK ]
</syntaxhighlight>
 
==확인 2==
<syntaxhighlight lang='console'>
root@zetawiki:~# curl -s -I http://localhost/greet.html
HTTP/1.1 200 OK
Date: Fri, 02 Oct 2015 06:44:45 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; charset=UTF-8
</syntaxhighlight>
:→ 캐릭터셋이 UTF-8로 나옴


==같이 보기==
==같이 보기==
*[[CentOS 아파치 기본캐릭터셋 UTF-8 설정]]
*[[아파치 DefaultCharset 확인]]
*[[아파치 DefaultCharset 확인]]
*[[/etc/apache2/conf-enabled/charset.conf]]
*[[/etc/apache2/conf-enabled/charset.conf]]


[[분류: 아파치]]
[[분류: 아파치]]
[[분류: Ubuntu]]
[[분류: UTF-8]]

2020년 11월 2일 (월) 00:57 기준 최신판

  다른 뜻에 대해서는 CentOS 아파치 기본캐릭터셋 UTF-8 설정 문서를 참조하십시오.
아파치 기본캐릭터셋 UTF-8 설정
아파치 AddDefaultCharset UTF-8

1 확인[ | ]

실제 동작 확인
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
→ 주석처리되어 있음

2 charset.conf 수정[ | ]

  • /etc/apache2/conf-enabled/charset.conf 파일에 있는 UTF-8 설정 주석 해제
root@zetawiki:~# vi /etc/apache2/conf-enabled/charset.conf
# Read the documentation before enabling AddDefaultCharset.
# In general, it is only a good idea if you know that all your files
# have this encoding. It will override any encoding given in the files
# in meta http-equiv or xml encoding tags.

AddDefaultCharset UTF-8

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

3 아파치 재시작[ | ]

root@zetawiki:~# /etc/init.d/apache2 restart
 * Restarting web server apache2                                                               [ OK ]

4 확인 2[ | ]

root@zetawiki:~# curl -s -I http://localhost/greet.html
HTTP/1.1 200 OK
Date: Fri, 02 Oct 2015 06:44:45 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; charset=UTF-8
→ 캐릭터셋이 UTF-8로 나옴

5 같이 보기[ | ]

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