RESTBase/Installation2
이 방법은 RESTBase 버전 1.0에 맞게 설정을 수정한 후로 재대로 동작을 하지 않습니다. 아마도 Let's Encrypt에 의한 HAProxy 설정 때문인 것으로 추정하고 있습니다. 어쨌든 외부에서 접근이 되도록 완전한 설정이 필요합니다. 알려주세요!!
RESTBase/Installation은 위키미디어 재단의 설정과 맞추기 위한 노력으로 만들어진 문서입니다. 그러나, http://dawoum.duckdns.org/api/rest_v1/ 으로 접근해서 ''Try it out!''을 누르면, http://dawoum.duckdns.org/localhost/v1/으로 접근이 되면서 404 오류가 발생합니다. 이전 설정을 두고 이 부분을 수정하는 방법은 아직 찾지를 못했습니다.
한편, mw:RESTBase/Installation에서 포트 번호를 직접 적어서 접근하는 방법이 있습니다. 이전 구성을 시험할 당시에는 동작을 하지 않았지만, 이제는 올바르게 작동을 합니다.
어쨌든, 이 지면은 설정 부분만 다루기 때문에 다른 과정이나, 또는 여기서 누락된 설정은 RESTBase/Installation을 참조하시기 바랍니다.
RESTBase configurations
RESTBase 설정 파일 config.yaml에서 다음을 수정합니다.
action:
# XXX Check API URL!
apiUriTemplate: http://localhost/w/api.php
baseUriTemplate: "{{'http://localhost:7231/{domain}/v1'}}" # 여기를 수정합니다.
Nginx configurations
웹 서버의 역방향-프록시 설정을 수정합니다. 다음과 같이 default를 수정합니다.
# 서버 블록 밖에 적습니다.
upstream restbase {
server localhost:7231;
keepalive 32;
}
map $request_uri $restbasequery {
default "xx";
"~/localhost/v1/(?<xrestbasequery>.*)$" "$xrestbasequery";
}
server {
...
# 서버 블록 안에 적습니다.
location /localhost/v1/ {
proxy_pass http://restbase/localhost/v1/$restbasequery;
}
...
}
MediaWiki configurations
미디어위키의 설정을 수정합니다. 다음과 같이 LocalSettings.php를 수정합니다.
$wgVisualEditorRestbaseURL = "http://dawoum.duckdns.org/localhost/v1/page/html/";
$wgVisualEditorFullRestbaseURL = "http://dawoum.duckdns.org/localhost/";
$wgElectronPdfServiceRESTbaseURL = '/localhost/v1/page/pdf/';
Others configurations
다른 부분의 설정을 추가적으로 수정해야 할지도 모릅니다.
문제점
이상하게도 이 설정으로 바꾸고 나면 수식을 바꾸는 과정이 오래 걸립니다. Varnish 또는 캐시의 영향인지 확인은 해보지 못했으며, 현재는 이전 설정으로 바꾸어서 사용중입니다.