블로깅 플랫폼 Ghost 시작하기

Tistory나 WordPress 없이 직접 블로그를 운영해보고 싶다면, Ghost가 굉장히 적합한 플랫폼이 될 것이다. Node.js 기반이며 마크다운을 지원하며 굉장히 개발자/연구자에게 적합한 블로깅 툴인 것 같다.

공식 홈페이지는 https://ghost.org 이다.

Node.js나 npm은 이미 설치 되어있다고 가정한다.
Ghost는 Node.js 0.10.xx 버전을 지원한다.

Node.js 버전 바꾸기

sudo 권한이 필요할 수도 있다.

npm install -g n   # Install n globally
n 0.10.33          # Install and use v0.10.33

설치

npm install --production
npm start

끝. 참 쉽죠?
혹시 첨부터 다른 node.js 버전으로 설치하다 에러났다면
rm -rf node_modules && npm cache clear && npm install

이메일 세팅하기

팀이랑 같이 운영하거나, 무튼 이메일 세팅을 해놔야 일이 수월하다.
http://support.ghost.org/mail 를 참고하면 편하다.
개인적으로 블로깅용 gmail을 새로 파서 세팅해주는 게 가장 편하다.
그냥 새로운 gmail 계정을 만들고
ghost 폴더에 있는 config.js에서

mail: {
    transport: 'SMTP',
    options: {
        service: 'Gmail',
        auth: {
            user: 'youremail@gmail.com',
            pass: 'yourpassword'
        }
    }
}.

를 추가/수정하자.

Nginx로 80 포트로 서비스하기, 최대허용파일 사이즈 늘리기

https://allaboutghost.com/how-to-proxy-port-80-to-2368-for-ghost-with-nginx/

Nginx를 설치한다. sudo apt-get install nginx -y
Nginx 설치 후 Ghost가 이미 2368에 있는 걸 알려 줘야함.
새로운 Nginx 설정 파일은
(CentOS) :/etc/nginx/conf.d/
(Ubuntu) :/etc/nginx/sites-enabled

설정 파일 이름은 your-domain-name.conf 처럼 짓는 게 좋다.
그리고 아래 에서 your-domain-name.com는 우리 도메인으로 바꾸자.
your-domain-name.conf 에서 다음을 추가/수정해주자.

server {
    listen 80;
    server_name your-domain-name.com;
    location / {
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   Host      $http_host;
        proxy_pass         http://127.0.0.1:2368;
    }
}

그리고 원래 default에 있는 건 삭제.
(불안하면 알아서 백업하자.)

rm /etc/nginx/sites-available/default
rm /etc/nginx/sites-enabled/default
rm /etc/nginx/conf.d/default

또 nginx에서 올릴 수 있는 파일의 최대 크기가 작으므로
/etc/nginx/nginx.conf에서 다음 http 블럭에 한줄 추가해주자.


http {
	#...
        client_max_body_size 100m;
	#...
}

그리고 nginx를 다시 킨다.
sudo service nginx restart
다시 켜는데 fail이 뜨면
아마도 your-domain-name.conf에서 잘못되었을 확률이 높다.