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

잔글 (봇: 자동으로 텍스트 교체 (-<source lang='cli'> +<source lang='console'>))
5번째 줄: 5번째 줄:
==확인==
==확인==
;실제 동작 확인
;실제 동작 확인
<source lang='cli'>
<source 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
20번째 줄: 20번째 줄:


;설정 파일 확인
;설정 파일 확인
<source lang='cli'>
<source 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.
29번째 줄: 29번째 줄:
==charset.conf 수정==
==charset.conf 수정==
*/etc/apache2/conf-enabled/charset.conf 파일에 있는 UTF-8 설정 주석 해제
*/etc/apache2/conf-enabled/charset.conf 파일에 있는 UTF-8 설정 주석 해제
<source lang='cli'>
<source lang='console'>
root@zetawiki:~# vi /etc/apache2/conf-enabled/charset.conf
root@zetawiki:~# vi /etc/apache2/conf-enabled/charset.conf
</source>
</source>
44번째 줄: 44번째 줄:


==아파치 재시작==
==아파치 재시작==
<source lang='cli'>
<source lang='console'>
root@zetawiki:~# /etc/init.d/apache2 restart
root@zetawiki:~# /etc/init.d/apache2 restart
  * Restarting web server apache2                                                              [ OK ]
  * Restarting web server apache2                                                              [ OK ]
50번째 줄: 50번째 줄:


==확인 2==
==확인 2==
<source lang='cli'>
<source lang='console'>
root@zetawiki:~# curl -s -I http://localhost/greet.html
root@zetawiki:~# curl -s -I http://localhost/greet.html
HTTP/1.1 200 OK
HTTP/1.1 200 OK

2016년 3월 29일 (화) 14:06 판

아파치 기본캐릭터셋 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 같이 보기