돌공공돌

라즈베리파이로 블로그용 가상 호스트를 만들자!😋 본문

IT/라즈베리파이

라즈베리파이로 블로그용 가상 호스트를 만들자!😋

오로시 2020. 5. 27. 00:12

라즈베리 파이에 전원을 공급하고, ip 주소를 알아냅니다.

 

ping -4 를 하면 아이피주소가 나와요
ssh pi@192.168.1.193 하면 되겠죠?ㅎㅎ

 

super  유저가 돼 볼게요.

 

Step 1: Install Nginx HTTP Server

 

apt update 

apt install nginx  로 nginx 를 다운 받습니다 그 후 

 

service nginx restart 해주세요.

 

 

 

Step 2: Install PHP 7.3 and Related Modules

 

 

apt install software-properties-common
apt update
apt install php7.3-fpm php7.3-common php7.3-mbstring php7.3-xmlrpc php7.3-sqlite3 php7.3-soap php7.3-gd php7.3-xml php7.3-cli php7.3-curl php7.3-zip

php를 다운 받아 줘요.

 

순서대로 해주면 막 쭈르륵 흰글씨 들이 써져 올라갈 거에요. 

저는 왠지 이게 기분이 좋더라구요 ㅎㅎ

 

Step 3: Configure Nginx Batflat Site

 

cd /etc/nginx/sites-available
vi myblog.com
cd /etc/nginx/sites-enabled
ln -s /etc/nginx/sites-available/myblog.com/myblog.com
nginx -t
service nginx4restart

 

vi 혹은 vim 을 통해 넣어야 할 내용은 다음과 같아요.

 

server {
    listen 80;
    listen [::]:80;
    root /home/사용자 계정/html/blog;
    index  index.php index.html index.htm;
    server_name  myblog.com;

     client_max_body_size 100M;

     autoindex off;

     location / {
       try_files $uri $uri/ @handler;
         }

     location  /admin {
        try_files $uri $uri/ /admin/index.php?$args;
        }
    
    location @handler {
        if (!-e $request_filename) { rewrite / /index.php last; }
        rewrite ^(.*.php)/ $1 last;
        }

    location ~ \.php$ {
         include snippets/fastcgi-php.conf;
         fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
         include fastcgi_params;
     }
}

Step 4: Download Batflat Latest Release

 

이제 사이트를 운영한 개인 계정으로 로그인해서 작업해 볼게요.

 

 

 

 

cd ~/html
wget https://github.com/sruupl/batflat/archive/master.zip
unzip master.zip
mv batflat-master blog
cd blog
mkdir./tmp
mkdir./admin/tmp
chmod -R 777./uploads ./inc/data./admin/tmp./tmp

 

 

 

Step 5 : hosts 파일 내용 변경하기

 

 

myblog.com 을 추가해 줍니다.

myblog.com은 가짜 도매인 , 실습을 위해 만든 가상 도메인 이기 때문에 이 작업을 해야 합니다.

 

Step 6 : 블로그 확인하기😶

 

이런 화면이 떴다면 성공입니다.

Step 7 : 관리자 모드로 들어가서, 블로그를 수정합니다.

Tistory와 차이점은, myblog.com 이라는 웹사이트를 제가 만들어 저만의 블로그를 만든다는 겁니다.

distroy는 tistroy 안에 유저들의 블로그가 있는 것이지요!

 

http://myblog.com/admin에 접속해줍니다.

 

id : admin

passwd: admin

 

 

다음 포스팅에서는 관리자 모드에 뭐가 있는 지 소개해 드리도록 하겠습니다.

 

감사합니다.!

 

 

 

 

Comments