
그누보드는 국산 설치형 무료 게시판입니다.
https://www.wsgvet.com현재 제가 메인 홈페이지로 쓰고 있는 중이기도 합니다.
제 홈페이지는 현재 그누보드 5.3이지만 테마만 괜찮은게 나오면 5.4로 넘어갈 예정입니다.
무료 홈페이지 주소 받기
https://blog.wsgvet.com/free-homepage-address-freenom클라우드 플레어 가입 및 네임서버 변경하기
https://blog.wsgvet.com/cloudflare-sign-in-and-change-nameserver구글 클라우드 플랫폼 가입, 도메인 연결, Nginx 설치
https://blog.wsgvet.com/sign-in-google-cloud-platform-and-connect-domain-and-hello-world구글 클라우드 컴퓨트 엔진에서 우분투 기본 설정하기
https://blog.wsgvet.com/google-cloud-compute-engine-ubuntu-basic-setting우분투 20.04 LTS에 MariaDB 설치하기
https://blog.wsgvet.com/ubuntu-2004-install-mariadb/위 5개 글에 따라 따라오셨다면 이제 이 글을 보시면 됩니다.
구글 클라우드 플랫폼의 무료 서버 성능에서는 ghost 플랫폼과 그누보드를 동시에 운용하기에는 조금 벅찰 수 있습니다.
그래서 ghost를 설치할땐 node.js 설치만 했습니다.
다만 그누보드나 워드프레스 같은 경우 php로 구동되기 때문에 php를 따로 설치해야 합니다.
그래서 node.js와 완전히 독립적으로 이 설치기를 작성합니다.
sudo apt install php7.4 php7.4-fpm php7.4-mysql php-common php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-readline php7.4-mbstring php7.4-xml php7.4-gd php7.4-curl
위 명령어로 패키지를 설치합니다.
조금만 기다리면 설치가 완료됩니다.
sudo systemctl enable php7.4-fpm
위 명령어로 재부팅시에 자동 시작되게 합니다.
sudo systemctl start php7.4-fpm
위 명령어로 실행합니다.
sudo nano /etc/php/7.4/fpm/php.ini
위 명령어로 들어가면 엄청나게 많은 글의 내용이 나오는데요.
short_open_tag = Onmemory_limit = 256Mcgi.fix_pathinfo = 0upload_max_filesize = 100Mpost_max_size = 101Mmax_execution_time = 360date.timezone = Asia/Seoul
위 항목을 찾아서 다 바꿔줍니다.
찾는 방법은 컨트롤 + W 누르면 밑에 검색창이 나오는데, 앞부분을 복사해서 붙여넣고 엔터를 치면 찾아집니다.
예를들어 short_open_tag를 바꾸고 싶다면 short_open_tag 를 넣고 엔터를 치면 해당부분으로 갑니다.
참고로 short_open_tag는 처음 검색하면 설명 부분이 나오는데 한번더 검색하면 제대로 나옵니다.
cgi.fix_pathinfo는 아마도 ;cgi.fix_pathinfo = 1 이렇게 되어있을텐데요. 앞에 ; 은 주석으로 처리한다는 뜻이므로 이것도 빼야겠죠.
즉 ;cgi.fix_pathinfo = 1 을 cgi.fix_pathinfo = 0 이렇게 바꿔줘야 하는 것입니다.
그 뒤에 수정하면 됩니다.
참고로 upload_max_filesize와 post_max_size는 파일 업로드 용량과 매우 높은 관계가 있습니다.
업로드할 파일 크기가 크다면 100M 이상으로 해주셔도 됩니다.
그리고 밑에 Nginx 설정에서도 하나 더 변경해줘야 됩니다. 따로 설명드리겠습니다.
전부 찾아서 다 바꾼 후
컨트롤 + O, 엔터, 컨트롤 + X를 누르면 저장 후 빠져나와집니다.
sudo systemctl reload php7.4-fpm
위 명령어로 설정을 적용해줍니다.
sudo mysql -u root -p
위 명령어로 DB에 접속합니다.
CREATE DATABASE gnuboard;
위 명령어로 gnuboard라는 DB를 만듭니다.
CREATE USER 'gnuuser'@'localhost' IDENTIFIED BY 'yourpassword';
위 명령어로 gnuuser라는 DB사용자를 만듭니다.
yourpassword 부분은 원하는 비번으로 꼭 수정하세요!
GRANT ALL ON gnuboard.* TO 'gnuuser'@'localhost' WITH GRANT OPTION;
위 명령어로 gnuuser가 gnuboard라는 DB의 모든 권한을 얻습니다.
FLUSH PRIVILEGES;EXIT;
위 두 명령어로 저장 후 나갑니다.
sudo mkdir -p /var/www/gnuboard
위 명령어로 그누보드 파일이 들어갈 폴더를 생성합니다.
sudo chown -R $USER:$USER /var/www/gnuboard
위 명령어로 방금 생성한 폴더의 권한을 지금 로그인한 계정으로 변경해줍니다.
cd /var/www/gnuboard
위 명령어로 폴더로 이동합니다.
curl -o gnuboard.tar.gz -fSL https://github.com/gnuboard/gnuboard5/tarball/master
위 명령어로 그누보드 최신버전을 다운 받습니다.
tar -xf gnuboard.tar.gz -C . --strip-components=1
위와 같이 현재 폴더에 압축을 풉니다.
rm gnuboard.tar.gz
위 명령어로 압축파일을 삭제합니다.
이제 권한을 수정해야 합니다.
sudo chmod -R 755 /var/www/gnuboard
그누 보드의 폴더 포함 모든 파일 및 폴더의 권한을 755로 줍니다.
mkdir /var/www/gnuboard/data
data 폴더를 생성합니다.
chmod 707 /var/www/gnuboard/data
data 폴더의 권한을 707로 줍니다.
chown -R www-data:www-data /var/www/gnuboard/data
data 폴더의 소유권을 www-data에게 줍니다.
nano /var/www/gnuboard/config.php
위 명령어로 설정파일로 들어갑니다.
29번째줄에 보면
define('G5_DOMAIN', '');define('G5_HTTPS_DOMAIN', '');
위 내용이 있습니다. 접속할 주소를 설정하는 곳입니다.
우리는 이미 SSL 인증서를 가지고 있기 때문에 둘다 같은 https 주소를 넣습니다.
예를들어 홈페이지 주소가 example.com이라면
define('G5_DOMAIN', 'https://example.com');define('G5_HTTPS_DOMAIN', 'https://example.com');
위와 같은 형식으로 넣고 저장하면 됩니다.
40번째 줄에
// Set Databse table default Charset// utf8, utf8mb4 등 지정 가능 기본값은 utf8, 설치전에 utf8mb4 으로 수정시 모든 테이블에 이모지 입력이 가능합니다. utf8mb4 는 mysql 또는 mariadb 5.5 버전 이상을 요구합니다.define('G5_DB_CHARSET', 'utf8mb4');
위와 같이 utf8을 utf8mb4로 바꿔줍니다. 이모지를 제목과 본문, 댓글에 표시할 수 있습니다.
그누보드 파일 설정은 이제 끝입니다.
sudo nano /etc/nginx/snippets/gnuboard-rewrite.conf
위 명령어로 설정파일 만들기에 들어갑니다.
#### 그누보드5 nginx rules BEGIN #####if (!-e $request_filename){rewrite ^/content/([0-9a-zA-Z_]+)$ /bbs/content.php?co_id=$1&rewrite=1 break;rewrite ^/content/([^/]+)/$ /bbs/content.php?co_seo_title=$1&rewrite=1 break;rewrite ^/rss/([0-9a-zA-Z_]+)$ /bbs/rss.php?bo_table=$1 break;rewrite ^/([0-9a-zA-Z_]+)$ /bbs/board.php?bo_table=$1&rewrite=1 break;rewrite ^/([0-9a-zA-Z_]+)/write$ /bbs/write.php?bo_table=$1&rewrite=1 break;rewrite ^/([0-9a-zA-Z_]+)/([^/]+)/$ /bbs/board.php?bo_table=$1&wr_seo_title=$2&rewrite=1 break;rewrite ^/([0-9a-zA-Z_]+)/([0-9]+)$ /bbs/board.php?bo_table=$1&wr_id=$2&rewrite=1 break;}#### 그누보드5 nginx rules END #####
위 내용을 그대로 복사 후 붙여넣기 해줍니다.
컨트롤 + O, 엔터, 컨트롤 + X 엔터를 누르면 저장 후 빠져나옵니다.
먼저 Nginx 설정파일부터 만듭니다.
sudo nano /etc/nginx/sites-available/gnuboard
위 명령어로 Nginx설정파일을 만들고 들어갑니다.
server {listen 80;listen [::]:80;server_name www.example.com example.com; # example.com를 자신이 원하는 도메인으로 수정하세요.root /var/www/gnuboard;index index.php ;include snippets/gnuboard-rewrite.conf;location ~ \.(gif|jpg|png)$ {add_header Vary "Accept-Encoding";add_header Cache-Control "public, no-transform, max-age=31536000";}location ~* \.(css|js)$ {add_header Cache-Control "public, max-age=604800";log_not_found off;access_log off;}location ~*.(mp4|ogg|ogv|svg|svgz|eot|otf|woff|woff2|ttf|rss|atom|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|cur)$ {add_header Cache-Control "max-age=31536000";access_log off;}charset utf-8;server_tokens off;client_max_body_size 100M;location / {try_files $uri $uri/ =404;}location ~ /\.ht {deny all;}location ~ \.php$ {include snippets/fastcgi-php.conf;fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;}}
위 내용에서 example.com 부분을 자신의 도메인으로 바꿔주세요.
참고로 업로드 용량을 100MB 이상을 원하신다면 client_max_body_size 100M;를 client_max_body_size 1000M;와 같이 뒤에 숫자를 변경해주면 됩니다.
그리고 컨트롤 + O, 엔터, 컨트롤 + X 엔터를 누르면 저장 후 빠져나옵니다.
sudo ln -s /etc/nginx/sites-available/gnuboard /etc/nginx/sites-enabled/
위 명령어로 설정파일을 활성화되게 해줍니다.
sudo rm -f /etc/nginx/sites-enabled/default
위 명령어로 기존 활성화된 default 서버 링크만 삭제해줍니다.
sudo nginx -t
위 명령어로 설정에 이상이 없는지 확인합니다.
$ sudo nginx -tnginx: the configuration file /etc/nginx/nginx.conf syntax is oknginx: configuration file /etc/nginx/nginx.conf test is successful
위와 같이 ok와 successful이 나오면 성공입니다.
sudo service nginx restart
위 명령어로 nginx를 재시작 해줍니다.
이제 python3-certbot-nginx를 통한 SSL 인증서 발급을 위한 준비는 끝났습니다.
sudo apt install python3-certbot-nginx
위 명령어로 Nginx와 연결할 수 있는 certbot을 설치합니다.
sudo certbot --nginx -d example.com -d www.example.com
이제 위와 같은 형식으로 자신의 도메인과 www.도메인에 SSL 인증서 생성을 시작합니다.
Saving debug log to /var/log/letsencrypt/letsencrypt.logPlugins selected: Authenticator nginx, Installer nginxEnter email address (used for urgent renewal and security notices) (Enter 'c' to cancel):
위와 같이 인증서 갱신 및 보안 공지 등을 받을 이메일 주소를 입력합니다.
Please read the Terms of Service athttps://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You mustagree in order to register with the ACME server athttps://acme-v02.api.letsencrypt.org/directory- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(A)gree/(C)ancel:
A를 입력하고 엔터를 누릅니다.
Would you be willing to share your email address with the Electronic FrontierFoundation, a founding partner of the Let's Encrypt project and the non-profitorganization that develops Certbot? We'd like to send you email about our workencrypting the web, EFF news, campaigns, and ways to support digital freedom.- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(Y)es/(N)o:
이메일 주소를 공유하고 싶다면 y, 그렇지 않다면 n을 입력하고 엔터를 누릅니다.
Obtaining a new certificatePerforming the following challenges:http-01 challenge for example.comhttp-01 challenge for www.example.comWaiting for verification...Cleaning up challengesDeploying Certificate to VirtualHost /etc/nginx/sites-enabled/gnuboardDeploying Certificate to VirtualHost /etc/nginx/sites-enabled/gnuboardPlease choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -1: No redirect - Make no further changes to the webserver configuration.2: Redirect - Make all requests redirect to secure HTTPS access. Choose this fornew sites, or if you're confident your site works on HTTPS. You can undo thischange by editing your web server's configuration.- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Select the appropriate number [1-2] then [enter] (press 'c' to cancel):
위와 같이 인증서가 발급됩니다. HTTP를 전부 HTTPS로 리다이렉트 하는 것이 좋습니다. 2를 입력하고 엔터를 누르면 됩니다.
Redirecting all traffic on port 80 to ssl in /etc/nginx/sites-enabled/gnuboardRedirecting all traffic on port 80 to ssl in /etc/nginx/sites-enabled/gnuboard- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Congratulations! You have successfully enabled https://example.com and https://www.example.comYou should test your configuration at:https://www.ssllabs.com/ssltest/analyze.html?d=example.comhttps://www.ssllabs.com/ssltest/analyze.html?d=www.example.com- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -IMPORTANT NOTES:- Congratulations! Your certificate and chain have been saved at:/etc/letsencrypt/live/example.com/fullchain.pemYour key file has been saved at:/etc/letsencrypt/live/example.com/privkey.pemYour cert will expire on 2021-01-29. To obtain a new or tweakedversion of this certificate in the future, simply run certbot againwith the "certonly" option. To non-interactively renew *all* ofyour certificates, run "certbot renew"- Your account credentials have been saved in your Certbotconfiguration directory at /etc/letsencrypt. You should make asecure backup of this folder now. This configuration directory willalso contain certificates and private keys obtained by Certbot somaking regular backups of this folder is ideal.- If you like Certbot, please consider supporting our work by:Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donateDonating to EFF: https://eff.org/donate-le
위와 같이 매우 쉽게 발급이 되었고, Nginx도 재기동되어 이제 주소창에 자신의 주소를 입력하면 바로 https로 접속되는 것을 확인할 수 있습니다.
정말 쉽죠?
sudo systemctl status certbot.timer
위 명령어를 내리면
● certbot.timer - Run certbot twice dailyLoaded: loaded (/lib/systemd/system/certbot.timer; enabled; vendor preset: enabled)Active: active (waiting) since Sat 2020-10-31 14:07:53 UTC; 14min agoTrigger: Sun 2020-11-01 01:50:41 UTC; 11h leftTriggers: ● certbot.service
위와 같이 나오는 것을 확인할 수 있습니다. 즉 하루에 2번씩 자동으로 갱신 체크를 해줍니다.
sudo certbot renew --dry-run
위 명령어를 내리면
Saving debug log to /var/log/letsencrypt/letsencrypt.log- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Processing /etc/letsencrypt/renewal/example.com.conf- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Cert not due for renewal, but simulating renewal for dry runPlugins selected: Authenticator nginx, Installer nginxRenewing an existing certificatePerforming the following challenges:http-01 challenge for example.comhttp-01 challenge for www.example.comWaiting for verification...Cleaning up challenges- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -new certificate deployed with reload of nginx server; fullchain is/etc/letsencrypt/live/example.com/fullchain.pem- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -** DRY RUN: simulating 'certbot renew' close to cert expiry** (The test certificates below have not been saved.)Congratulations, all renewals succeeded. The following certs have been renewed:/etc/letsencrypt/live/example.com/fullchain.pem (success)** DRY RUN: simulating 'certbot renew' close to cert expiry** (The test certificates above have not been saved.)- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -IMPORTANT NOTES:- Your account credentials have been saved in your Certbotconfiguration directory at /etc/letsencrypt. You should make asecure backup of this folder now. This configuration directory willalso contain certificates and private keys obtained by Certbot somaking regular backups of this folder is ideal.
위와 같이 Congratulations, all renewals succeeded. 내용이 뜨면 갱신에 문제가 없다는 뜻입니다.
이제 주소창에 설정한 주소 를 넣어보세요.
위와 같이 뜬다면 성공입니다.
그누보드5 설치하기를 누릅니다.
동의합니다 -> 다음
위와 같이 셋팅하면 됩니다.
MySQL 정보는 아까 같이 만들었던 그 계정을 넣으면 됩니다.
밑에 최고관리자는 100% 원하시는대로 만들면 됩니다
참고로 회원 ID에 admin으로 되어있는데 바꿔주시는게 보안에 좋습니다.
다 적은 후 다음을 누르면
위와 같이 나오면 드디어 끝입니다.
새로운 그누보드5로 이동을 누르면!
위와 같이 초기화면이 나오면서 완성되었습니다!
감사합니다!
