"미디어위키 업로드 가능하게 하기"의 두 판 사이의 차이

(새 문서: ==설정파일 변경== 설치폴더에 있는 LocalSettings.php에서 $wgEnableUploads를 true로 해주면 된다. *변경 전 <source lang='php'> ## To enable image uploads, m...)
 
잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
 
(사용자 2명의 중간 판 33개는 보이지 않습니다)
1번째 줄: 1번째 줄:
{{테스트|미디어위키 1.18.0, 리눅스}}
;미디어위키 업로드 가능하게 하기
;미디어위키 업로드 설정
;미디어위키 업로드 폴더 권한 문제
==설정파일 변경==
==설정파일 변경==
설치폴더에 있는 [[LocalSettings.php]]에서 $wgEnableUploads를 true로 해주면 된다.
미디어위키를 처음 설치했을 때는 업로드가 불가능하게 되어 있다.
왼쪽 도구모음 메뉴에 '파일 올리기'가 없을 것이다.
설치폴더에 있는 [[LocalSettings.php]]에서 $wgEnableUploads를 true로 해주면 나타난다.


*변경 전
*변경 전
<source lang='php'>
<syntaxhighlight 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;
</source>
</syntaxhighlight>


*변경 후
*변경 후
<source lang='php'>
<syntaxhighlight 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;
</source>
</syntaxhighlight>
이렇게 하면 왼쪽 메뉴의 도구모음에 '파일 올리기'가 생길 것이다.
이렇게 파일을 수정하고 웹사이트를 열면 왼쪽 메뉴의 도구모음에 '파일 올리기'가 보일 것이다.


==폴더 권한==
==폴더 권한==
파일 올리기가 안되는 경우 설치폴더 아래의 images 폴더의 권한을 확인하고, 업로드가 가능하도록 권한을 조정한다.
파일 올리기가 안되는 경우 설치폴더 아래의 images 폴더의 권한을 확인하고, 업로드가 가능하도록 권한을 조정한다.
*[[미디어위키 폴더]]로 이동하여 images의 소유자와 퍼미션 확인
<syntaxhighlight lang='console'>
[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'>
[root@zetawiki w]# ps -ef | grep httpd | grep -v grep
root    26460    1  0 01:37 ?        00:00:00 /usr/sbin/httpd
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
... (생략)
apache  31072 26460  0 04:22 ?        00:00:48 /usr/sbin/httpd
</syntaxhighlight>
:→ 부모 프로세스는 1개 있고 root 권한으로, 자식 프로세스는 여러 개 있고 apache 권한으로 실행된다.
:→ httpd가 파일에 접근할 때는 apache 권한을 가지게 된다.
따라서 image 폴더의 소유자를 apache로, 퍼미션을 700으로 해보자.<ref>apache 계정만 자유롭게 읽고 쓸 수 있게 함</ref>
<syntaxhighlight lang='console'>
[root@zetawiki w]# chown -R apache:apache images
[root@zetawiki w]# chmod -R 700 images
[root@zetawiki w]# ll -d images
drwx------ 22 apache apache 4096 Sep  2 22:38 images
</syntaxhighlight>
==같이 보기==
* [[미디어위키 업로드 파일 확장자]] (확장자 문제)
* [[미디어위키 $wgEnableUploads]]
* [[미디어위키 파일 업로드 최대 크기 지정]]
==참고==


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

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

미디어위키 업로드 가능하게 하기
미디어위키 업로드 설정
미디어위키 업로드 폴더 권한 문제

1 설정파일 변경[ | ]

미디어위키를 처음 설치했을 때는 업로드가 불가능하게 되어 있다. 왼쪽 도구모음 메뉴에 '파일 올리기'가 없을 것이다. 설치폴더에 있는 LocalSettings.php에서 $wgEnableUploads를 true로 해주면 나타난다.

  • 변경 전
## To enable image uploads, make sure the 'images' directory
## is writable, then set this to true:
$wgEnableUploads  = false;
  • 변경 후
## To enable image uploads, make sure the 'images' directory
## is writable, then set this to true:
$wgEnableUploads  = true;

이렇게 파일을 수정하고 웹사이트를 열면 왼쪽 메뉴의 도구모음에 '파일 올리기'가 보일 것이다.

2 폴더 권한[ | ]

파일 올리기가 안되는 경우 설치폴더 아래의 images 폴더의 권한을 확인하고, 업로드가 가능하도록 권한을 조정한다.

[root@zetawiki w]# ll -d images
drwxr-xr-x  2 root root   4096 Jul  8  2011 images
→ 특별히 건드리지 않았다면 위와 같이 소유자는 root, 퍼미션은 755일 것이다.
  • httpd 프로세스의 owner를 확인해보자.
[root@zetawiki w]# ps -ef | grep httpd | grep -v grep
root     26460     1  0 01:37 ?        00:00:00 /usr/sbin/httpd
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
... (생략)
apache   31072 26460  0 04:22 ?        00:00:48 /usr/sbin/httpd
→ 부모 프로세스는 1개 있고 root 권한으로, 자식 프로세스는 여러 개 있고 apache 권한으로 실행된다.
→ httpd가 파일에 접근할 때는 apache 권한을 가지게 된다.

따라서 image 폴더의 소유자를 apache로, 퍼미션을 700으로 해보자.[1]

[root@zetawiki w]# chown -R apache:apache images
[root@zetawiki w]# chmod -R 700 images
[root@zetawiki w]# ll -d images
drwx------ 22 apache apache 4096 Sep  2 22:38 images

3 같이 보기[ | ]

4 참고[ | ]

  1. apache 계정만 자유롭게 읽고 쓸 수 있게 함
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}