미디어위키 업로드 가능하게 하기 편집하기

경고: 로그인하지 않았습니다. 편집을 하면 IP 주소가 공개되게 됩니다. 로그인하거나 계정을 생성하면 편집자가 사용자 이름으로 기록되고, 다른 장점도 있습니다.

편집을 취소할 수 있습니다. 이 편집을 되돌리려면 아래의 바뀐 내용을 확인한 후 게시해주세요.

최신판 당신의 편집
1번째 줄: 1번째 줄:
{{테스트|미디어위키 1.18.0, 리눅스}}
{{테스트|미디어위키 1.18.0, 리눅스}}
;미디어위키 업로드 가능하게 하기
;미디어위키 업로드 설정
;미디어위키 업로드 폴더 권한 문제


==설정파일 변경==
==설정파일 변경==
10번째 줄: 7번째 줄:


*변경 전
*변경 전
<syntaxhighlight lang='php'>
<source lang='php'>
## To enable image uploads, make sure the 'images' directory
## To enable image uploads, make sure the 'images' directory
## is writable, then set this to true:
## is writable, then set this to true:
$wgEnableUploads  = false;
$wgEnableUploads  = false;
</syntaxhighlight>
</source>


*변경 후
*변경 후
<syntaxhighlight lang='php'>
<source lang='php'>
## To enable image uploads, make sure the 'images' directory
## To enable image uploads, make sure the 'images' directory
## is writable, then set this to true:
## is writable, then set this to true:
$wgEnableUploads  = true;
$wgEnableUploads  = true;
</syntaxhighlight>
</source>
이렇게 파일을 수정하고 웹사이트를 열면 왼쪽 메뉴의 도구모음에 '파일 올리기'가 보일 것이다.
이렇게 파일을 수정하고 웹사이트를 열면 왼쪽 메뉴의 도구모음에 '파일 올리기'가 보일 것이다.


==폴더 권한==
==폴더 권한==
파일 올리기가 안되는 경우 설치폴더 아래의 images 폴더의 권한을 확인하고, 업로드가 가능하도록 권한을 조정한다.
*파일 올리기가 안되는 경우 설치폴더 아래의 images 폴더의 권한을 확인하고, 업로드가 가능하도록 권한을 조정한다.
*[[미디어위키 폴더]]로 이동하여 images의 소유자와 퍼미션 확인
*특별히 건드리지 않았다면 images 권한의 초기 상태는 755일 것이다. 757로 바꿔보자. 그래도 안된다면 777로 바꿔보자.
<syntaxhighlight lang='console'>
(images 폴더의 소유자(owner) 계정, 아파치 구동 계정에 따라 달라질 수 있다.)
[root@zetawiki w]# ll -d images
drwxr-xr-x  2 root root  4096 Jul  8  2011 images
</syntaxhighlight>
:→ 특별히 건드리지 않았다면 위와 같이 소유자는 root, 퍼미션은 755일 것이다.


*[[httpd]] 프로세스의 owner를 확인해보자.
;명령어
<syntaxhighlight lang='console'>
<source lang='bash'>
[root@zetawiki w]# ps -ef | grep httpd | grep -v grep
chmod -R 757 images
root    26460    1 0 01:37 ?        00:00:00 /usr/sbin/httpd
</source>
apache   28239 26460 0 04:02 ?        00:00:48 /usr/sbin/httpd
 
apache  28240 26460 0 04:02 ?        00:00:49 /usr/sbin/httpd
;변경 전
apache  28241 26460  0 04:02 ?        00:00:47 /usr/sbin/httpd
<source lang='dos'>
... (생략)
[root@jmnote wiki]# ll | grep images
apache  31072 26460  0 04:22 ?        00:00:48 /usr/sbin/httpd
drwxr-xr-x 2 1244 1244   4096 Jul 8 2011 images
</syntaxhighlight>
</source>
:→ 부모 프로세스는 1개 있고 root 권한으로, 자식 프로세스는 여러 개 있고 apache 권한으로 실행된다.
 
:→ httpd가 파일에 접근할 때는 apache 권한을 가지게 된다.
;변경 후
따라서 image 폴더의 소유자를 apache로, 퍼미션을 700으로 해보자.<ref>apache 계정만 자유롭게 읽고 쓸 수 있게 함</ref>
<source lang='dos'>
<syntaxhighlight lang='console'>
[root@jmnote wiki]# chmod -R 757 images
[root@zetawiki w]# chown -R apache:apache images
[root@jmnote wiki]# ll | grep images
[root@zetawiki w]# chmod -R 700 images
drwxr-xrwx  4 1244 1244  4096 Jan 25 11:22 images
[root@zetawiki w]# ll -d images
</source>
drwx------ 22 apache apache 4096 Sep  2 22:38 images
 
</syntaxhighlight>
===테스트===
*555: 오류 The upload directory (public) is not writable by the webserver.
*655: 오류 The upload directory (public) is not writable by the webserver.
*755: 오류 The upload directory (public) is not writable by the webserver.
*556: 오류 Could not create directory "public/5/5b".
*656: 오류 Could not create directory "public/5/5b".
*756: 오류 Could not create directory "public/5/5b".
*557: 오류 Could not create directory "public/archive/5/5b".
*657: 오류 Could not create directory "public/archive/5/5b".
*757: 성공


==같이 보기==
==같이 보기==
* [[미디어위키 업로드 파일 확장자]] (확장자 문제)
*[[미디어위키 업로드 파일 확장자]]
* [[미디어위키 $wgEnableUploads]]
* [[미디어위키 파일 업로드 최대 크기 지정]]
 
==참고==


[[분류: 미디어위키 업로드]]
[[분류:미디어위키]]

제타위키에서의 모든 기여는 크리에이티브 커먼즈 저작자표시-동일조건변경허락 3.0 라이선스로 배포된다는 점을 유의해 주세요(자세한 내용에 대해서는 제타위키:저작권 문서를 읽어주세요). 만약 여기에 동의하지 않는다면 문서를 저장하지 말아 주세요.
또한, 직접 작성했거나 퍼블릭 도메인과 같은 자유 문서에서 가져왔다는 것을 보증해야 합니다. 저작권이 있는 내용을 허가 없이 저장하지 마세요!

취소 편집 도움말 (새 창에서 열림)

이 문서에서 사용한 틀: