⚾️ 서비스와 나🧢 - ☁️8☁️ ⚾️




🚩 나만의 도메인 사용하기 - suhyouri LOG



완성을 향한 발걸음~🎵

#### 1단계: uptime & access
nomachine -> key-based login
rsa 키를 하나 만드세요.:
    ssh-keygen -t rsa -b 4096
cd .nx/config/
nano authorized.crt
id_rsa.pub의 내용을 붙여넣고 저장

https://kb.nomachine.com/AR02L00785
doohoyi@xu4:~/.nx/config$ chmod 600 authorized.crt
sudo /etc/NX/nxserver --restart

#### 2단계: resilence 탄력적인 서버 고장이 잘안남
#### 3단계: 안심보험~
#### 4단계: 웹하드! - 파일 서비스
+기본적으로 신규가입을 금지시킬것
사용자들을 받는 법. & 접근영역을 제한하는 법. (프라이버시)

#### 5단계: 공유지~ 공원..🐸 - 패드 서비스
etherpad의 admin 유저 로그인
cd etherpad-lite
nano settings.json
  "users": {
    "admin": {
을 찾아서 블럭 {} 위 아래의  /* */ 를 제거하고.. 비번을 바꾸세요.
pm2 restart pad


플러그인을 추가 설치하는 법
plugin UI 가 작동을 안해서, 터미널에서 하는 방법으로...
https://github.com/ether/etherpad-lite/wiki/Available-Plugins
https://static.etherpad.org/index.html
cd etherpad-lite
every.dianaband.info와 같은 플러그인 셋업을 하려면...
pnpm run plugins install ep_adminpads2 ep_align ep_author_hover ep_comments_page ep_countable ep_embedmedia ep_font_color ep_font_size ep_headings2 ep_image_upload ep_print ep_themes
pm2 restart pad

패드 관리하기
/admin

padlist 패드 목록 + 목록에 노출되지 않는 패드?
pnpm run plugins install ep_pad-lister
패드 이름이 private_ 로 시작하는 경우 패드 목록에 나타나지 않아요.

플러그인 삭제하기 -> UI로도 가능
터미널에서는
pnpm run plugins rm ep_<plugin name>

#### 6단계: 대문/hello 입장하기.. 게시하기.. 🏠
    웹 서비스
blog를 할 수 있는 상태
hugo
https://themes.gohugo.io/

wget http://ftp.us.debian.org/debian/pool/main/h/hugo/hugo_0.111.3-1_armhf.deb
wget http://ftp.us.debian.org/debian/pool/main/h/hugo/hugo_0.111.3-1_amd64.deb
sudo dpkg -i hugo_0.111.3-1_armhf.deb
sudo apt install -f
hugo version

cd /var/www/public/
mkdir blog

sudo nano /etc/nginx/sites-available/default
    location /blog {
        alias /var/www/public/blog;
    }
추가...
sudo nginx -s reload

https://gohugo.io/getting-started/quick-start/
doohoyi@xu4:/var/www/public$ hugo new site blog
git clone https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke
git clone https://github.com/monkeyWzr/hugo-theme-cactus.git themes/cactus





baseURL = '/blog/'
languageCode = 'en-us'
title = 'My Hugo Site'
theme = 'cactus'

timeZone = 'Asia/Seoul'

[params]
  colortheme = "light" # dark, light, white, or classic
  mainSection = "posts"
  
# Main menu which appears below site header.
[[menu.main]]
name = "Home"
url = "/"
weight = 1

[[menu.main]]
name = "All posts"
url = "/posts"
weight = 2

[[menu.main]]
name = "Tags"
url = "/tags"
weight = 3

[[menu.main]]
name = "About"
url = "/about"
weight = 4




pm2 start hugo -- -w

(hugo -w : 파일 변화를 감지하는 상태..)


pm2 save



html/css 작업 가능
lichen

nginx's autoindexcms



---




map $http_upgrade $connection_upgrade {
    default upgrade;
    '' close;
}

server
{
    if ($host = xu4.ururu.cloud) {
        return 301 https://$host$request_uri;
    }
    # managed by Certbot

    listen 80;
    listen [::]:80;
    server_name xu4.ururu.cloud;

    location /.well-known/acme-challenge/ {
        allow all;
    }

    location / {
        return 301 https://$host$request_uri;
    }
}

server
{
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name xu4.ururu.cloud;

    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers HIGH:!MEDIUM:!LOW:!aNULL:!NULL:!SHA;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_tickets off;
    ssl_certificate /etc/letsencrypt/live/xu4.ururu.cloud/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/xu4.ururu.cloud/privkey.pem; # managed by Certbot

    add_header Strict-Transport-Security "max-age=31536000" always;

    root /var/www/public;
    index index.md index.html;

    client_max_body_size 1G;
    client_body_timeout 300s;

    location /autoindex {
        alias /var/www/public/autoindex/;
        autoindex on;
    }

    location /blog {
        alias /var/www/public/blog;
    }

    location / {

        # --- try .md files without extensions
        if (-f ${document_root}${uri}.md) {
            set $redirect_url ${uri}.md;
            set $is_redirected true;
            set $new_url /cms/render.php?${redirect_url};
            rewrite ^(.*)$ $new_url last;
        }

        # --- try index files
        if (-f ${document_root}${uri}index.md) {
            set $redirect_url ${uri}index.md;
            set $is_redirected true;
            rewrite ^(.*)$ /cms/render.php?${redirect_url} last;
        }

        try_files ${uri} ${uri}/ =404;
    }

    # this whole location block of /cms/edit.php
    # is not needed if you are not using http basic auth
    # and can be removed, and you can just use the /cms/ location block
    location /cms/edit.php {
        auth_basic "CMS";
        # the file below needs to be created
        # instructions on how to do so can be found here:
        # https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/
        auth_basic_user_file /etc/apache2/.htpasswd;

        fastcgi_split_path_info ^(.+\\.php)\\?*(\\/.+)$;
        set $path_info $fastcgi_path_info;

        fastcgi_pass unix:/run/php/php-fpm.sock;
        include fastcgi_params;

        fastcgi_param REDIRECT_URL $redirect_url if_not_empty;
        fastcgi_param SCRIPT_FILENAME ${document_root}${fastcgi_script_name};
        fastcgi_param PATH_INFO $path_info;

        try_files $fastcgi_script_name =404;
    }

    location /cms/ {

        fastcgi_split_path_info ^(.+\\.php)\\?*(\\/.+)$;
        set $path_info $fastcgi_path_info;

        fastcgi_pass unix:/var/run/php/php-fpm.sock;
        include fastcgi_params;

        fastcgi_param REDIRECT_URL $redirect_url if_not_empty;
        fastcgi_param SCRIPT_FILENAME ${document_root}${fastcgi_script_name};
        fastcgi_param PATH_INFO $path_info;

        try_files $fastcgi_script_name =404;
    }

    location /theme/ {
        return 404;
    }

    location /pad {

        rewrite /pad/(.*) /$1 break;
        rewrite ^/pad$ /pad/ permanent;
        proxy_redirect / /pad/;

        proxy_pass http://127.0.0.1:9001;
        proxy_buffering off; # be careful, this line doesn't override any proxy_buffering on set in a conf.d/file.conf
        proxy_set_header Host $host;
        proxy_pass_header Server;

        # Note you might want to pass more headers etc too. See above configs.
    }

    location /pad/socket.io {

        rewrite /pad/socket.io/(.*) /socket.io/$1 break;
        proxy_redirect / /pad/;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_pass http://127.0.0.1:9001;
        proxy_buffering off; # be careful, this line doesn't override any proxy_buffering on set in a conf.d/file.conf
        proxy_set_header Host $host;
        proxy_pass_header Server;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        # Note you might want to pass more headers etc too. See above configs.
    }

    location /pad/admin {

        rewrite /pad/admin/(.*) /admin/$1 break;
        rewrite ^/pad/admin$ /pad/admin/ permanent;
        proxy_redirect / /pad/;
        proxy_set_header X-Proxy-Path /pad;
        proxy_pass http://127.0.0.1:9001;

        proxy_buffering off; # be careful, this line doesn't override any proxy_buffering on set in a conf.d/file.conf
        proxy_set_header Host $host;
        proxy_pass_header Server;

        # Note you might want to pass more headers etc too. See above configs.
    }

    location /pad/admin-auth {

        rewrite /pad/admin-auth/(.*) /admin-auth/$1 break;
        proxy_redirect / /pad/;
        proxy_set_header X-Proxy-Path /pad;
        proxy_pass http://127.0.0.1:9001;

        proxy_buffering off; # be careful, this line doesn't override any proxy_buffering on set in a conf.d/file.conf
        proxy_set_header Host $host;
        proxy_pass_header Server;

        # Note you might want to pass more headers etc too. See above configs.
    }

    location /pad/static {

        rewrite /pad/static/(.*) /static/$1 break;

        proxy_pass http://127.0.0.1:9001;
        proxy_buffering off; # be careful, this line doesn't override any proxy_buffering on set in a conf.d/file.conf
        proxy_set_header Host $host;
        proxy_pass_header Server;

        # Note you might want to pass more headers etc too. See above configs.
    }

    access_log /var/log/nginx/xu4.ururu.cloud-access.log;
    error_log /var/log/nginx/xu4.ururu.cloud-error.log debug;
}