사용자 도구

사이트 도구


miniserver:xenial

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판이전 판
다음 판
이전 판
miniserver:xenial [2017/07/24 00:48] – resilio-sync 부분 추가. changwoominiserver:xenial [2018/01/02 02:34] (현재) – [Torrent] 잘못된 스크립트 수정 changwoo
줄 140: 줄 140:
  
 ==== Dokuwiki ==== ==== Dokuwiki ====
 +
 <code - vhost-wiki.conf> <code - vhost-wiki.conf>
 # Nginx Configuration # Nginx Configuration
 +
 +# 아래 설정은 https 적용 이후 http -> https 이동에 사용됨.
 +server {
 +    listen     80;
 +    server_name     wiki.changwoo.pe.kr;
 +    return          301 https://$server_name$request_uri;
 +}
  
 server { server {
줄 194: 줄 202:
 </code> </code>
  
 +nginx라면 복구 이후 멋진 URL에서 .htaccess 방식을 선택해야 문서가 올바르게 보인다.
 ==== WordPress ==== ==== WordPress ====
 이 녀석은 조금 복잡하다. 이 녀석은 조금 복잡하다.
줄 270: 줄 279:
  
 <code - vhost-wordpress.conf> <code - vhost-wordpress.conf>
 +
 +# 아래 설정은 https 적용 이후 http -> https 이동에 사용됨.
 +server {
 +    listen     80;
 +    server_name     wiki.changwoo.pe.kr;
 +    return          301 https://$server_name$request_uri;
 +}
 +
 server { server {
  server_name blog.changwoo.pe.kr;  server_name blog.changwoo.pe.kr;
줄 277: 줄 294:
  index index.php;  index index.php;
  
- include /media/storage/www-data/conf.d/wordpress-restrictions.conf;+        # wp-login.php, wp-admin 접근을 IP로 제한 (단, wp-ajax.php는 AJAX를 활용해야 하므로 허용) 
 +        location ~ ^/(wp-admin(?!/admin-ajax\.php)|wp-login.php) { 
 +            allow 192.168.0.0/24; 
 +            deny all; 
 +            include snippets/fastcgi-php.conf; 
 +     fastcgi_pass unix:/run/php/php7.0-fpm.sock; 
 +        }
  
 + include /media/storage/www-data/conf.d/wordpress-restrictions.conf;
  include /media/storage/www-data/conf.d/wordpress.conf;  include /media/storage/www-data/conf.d/wordpress.conf;
 } }
줄 668: 줄 692:
 <code - deluge-daemon> <code - deluge-daemon>
 #!/bin/sh #!/bin/sh
-### BEGIN INIT INFO 
-# Provides:          deluge-daemon 
-# Required-Start:    $local_fs $remote_fs 
-# Required-Stop:     $local_fs $remote_fs 
-# Should-Start:      $network 
-# Should-Stop:       $network 
-# Default-Start:     2 3 4 5 
-# Default-Stop:      0 1 6 
-# Short-Description: Daemonized version of deluge and webui. 
-# Description:       Starts the deluge daemon with the user specified in 
-#                    /etc/default/deluge-daemon. 
-### END INIT INFO 
- 
-# Author: Adolfo R. Brandes  
-# Updated by: Jean-Philippe "Orax" Roemer 
- 
-PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 
-DESC="Deluge Daemon" 
-NAME1="deluged" 
-NAME2="deluge" 
-DAEMON1=/usr/bin/deluged 
-DAEMON1_ARGS="-d -c /media/storage/changwoo/.config/deluge -L info -l /media/storage/changwoo/.config/deluge/deluge.log"             # Consult `man deluged` for more options 
-DAEMON2=/usr/bin/deluge-web 
-DAEMON2_ARGS=""               # Consult `man deluge-web` for more options 
-PIDFILE1=/var/run/$NAME1.pid 
-PIDFILE2=/var/run/$NAME2.pid 
-UMASK=022                     # Change this to 0 if running deluged as its own user 
-PKGNAME=deluge-daemon 
-SCRIPTNAME=/etc/init.d/$PKGNAME 
- 
-# Exit if the package is not installed 
-[ -x "$DAEMON1" -a -x "$DAEMON2" ] || exit 0 
- 
-# Read configuration variable file if it is present 
-[ -r /etc/default/$PKGNAME ] && . /etc/default/$PKGNAME 
- 
-# Load the VERBOSE setting and other rcS variables 
-[ -f /etc/default/rcS ] && . /etc/default/rcS 
- 
-# Define LSB log_* functions. 
-# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. 
-. /lib/lsb/init-functions 
- 
-if [ -z "$RUN_AT_STARTUP" -o "$RUN_AT_STARTUP" != "YES" ] 
-then 
-   log_warning_msg "Not starting $PKGNAME, edit /etc/default/$PKGNAME to start it." 
-   exit 0 
-fi 
- 
-if [ -z "$DELUGED_USER" ] 
-then 
-    log_warning_msg "Not starting $PKGNAME, DELUGED_USER not set in /etc/default/$PKGNAME." 
-    exit 0 
-fi 
- 
-# 
-# Function to verify if a pid is alive 
-# 
-is_alive() 
-{ 
-   pid=`cat $1` > /dev/null 2>&1 
-   kill -0 $pid > /dev/null 2>&1 
-   return $? 
-} 
- 
-# 
-# Function that starts the daemon/service 
-# 
-do_start() 
-{ 
-   # Return 
-   #   0 if daemon has been started 
-   #   1 if daemon was already running 
-   #   2 if daemon could not be started 
- 
-   is_alive $PIDFILE1 
-   RETVAL1="$?" 
- 
-   if [ $RETVAL1 != 0 ]; then 
-       rm -f $PIDFILE1 
-       start-stop-daemon --start --background --quiet --pidfile $PIDFILE1 --make-pidfile \ 
-       --exec $DAEMON1 --chuid $DELUGED_USER --user $DELUGED_USER --umask $UMASK -- $DAEMON1_ARGS 
-       RETVAL1="$?" 
-   else 
-       is_alive $PIDFILE2 
-       RETVAL2="$?" 
-       [ "$RETVAL2" = "0" -a "$RETVAL1" = "0" ] && return 1 
-   fi 
- 
-   is_alive $PIDFILE2 
-   RETVAL2="$?" 
- 
-   if [ $RETVAL2 != 0 ]; then 
-        sleep 2 
-        rm -f $PIDFILE2 
-        start-stop-daemon --start --background --quiet --pidfile $PIDFILE2 --make-pidfile \ 
-        --exec $DAEMON2 --chuid $DELUGED_USER --user $DELUGED_USER --umask $UMASK -- $DAEMON2_ARGS 
-        RETVAL2="$?" 
-   fi 
-   [ "$RETVAL1" = "0" -a "$RETVAL2" = "0" ] || return 2 
-} 
- 
-# 
-# Function that stops the daemon/service 
-# 
-do_stop() 
-{ 
-   # Return 
-   #   0 if daemon has been stopped 
-   #   1 if daemon was already stopped 
-   #   2 if daemon could not be stopped 
-   #   other if a failure occurred 
- 
-   start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --user $DELUGED_USER --pidfile $PIDFILE2 
-   RETVAL2="$?" 
-   start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --user $DELUGED_USER --pidfile $PIDFILE1 
-   RETVAL1="$?" 
-   [ "$RETVAL1" = "2" -o "$RETVAL2" = "2" ] && return 2 
- 
-   rm -f $PIDFILE1 $PIDFILE2 
- 
-   [ "$RETVAL1" = "0" -a "$RETVAL2" = "0" ] && return 0 || return 1 
-} 
- 
-case "$1" in 
-  start) 
-   [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME1" 
-   do_start 
-   case "$?" in 
-      0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 
-      2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; 
-   esac 
-   ;; 
-  stop) 
-   [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME1" 
-   do_stop 
-   case "$?" in 
-      0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 
-      2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; 
-   esac 
-   ;; 
-  restart|force-reload) 
-   log_daemon_msg "Restarting $DESC" "$NAME1" 
-   do_stop 
-   case "$?" in 
-     0|1) 
-      do_start 
-      case "$?" in 
-         0) log_end_msg 0 ;; 
-         1) log_end_msg 1 ;; # Old process is still running 
-         *) log_end_msg 1 ;; # Failed to start 
-      esac 
-      ;; 
-     *) 
-        # Failed to stop 
-      log_end_msg 1#!/bin/sh 
 ### BEGIN INIT INFO ### BEGIN INIT INFO
 # Provides:          deluge-daemon # Provides:          deluge-daemon
줄 980: 줄 848:
         # Failed to stop         # Failed to stop
       log_end_msg 1       log_end_msg 1
-      ;; 
-   esac 
-   ;; 
-  *) 
-   echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 
-   exit 3 
-   ;; 
-esac 
- 
-: 
       ;;       ;;
    esac    esac
줄 1044: 줄 902:
  
  
-==== Resilio-Sync ====+===== Resilio-Sync =====
 [[https://www.resilio.com/ | Resilio-Sync ]]로 비트토렌트 방식의 싱크. [[project:btsyncforrpi | 라즈베리 파이에서 BitTorrentSync로 데이터 동기화하기 ]] 같은 문서로도 작성한 바가 있다. 이게 이름이 바뀌었다. [[https://www.resilio.com/ | Resilio-Sync ]]로 비트토렌트 방식의 싱크. [[project:btsyncforrpi | 라즈베리 파이에서 BitTorrentSync로 데이터 동기화하기 ]] 같은 문서로도 작성한 바가 있다. 이게 이름이 바뀌었다.
  
줄 1056: 줄 914:
 User=changwoo User=changwoo
 Group=changwoo Group=changwoo
 +PIDFile=
 PIDFile=/home/changwoo/.config/resilio-sync/sync.pid PIDFile=/home/changwoo/.config/resilio-sync/sync.pid
 +ExecStartPre=
 ExecStartPre=/bin/mkdir -p /home/changwoo/.config/resilio-sync ExecStartPre=/bin/mkdir -p /home/changwoo/.config/resilio-sync
-ExecStart=/bin/chown -R changwoo:changwoo /home/changwoo/.config/resilio-sync+ExecStartPre=/bin/chown -R changwoo:changwoo /home/changwoo/.config/resilio-sync 
 +ExecStart=
 ExecStart=/usr/bin/rslsync --config /home/changwoo/.config/resilio-sync/config.json ExecStart=/usr/bin/rslsync --config /home/changwoo/.config/resilio-sync/config.json
 </code> </code>
  
-systemctl edit 명령은 파일 자체를 변경하는 것이 아니라 overriding 하는 방식이다. 그러므로+systemctl edit 명령은 파일 자체를 변경하는 것이 아니라 overriding 하는 방식이다.그리고 override 할 때 기존 명령어는 한번 비워주는 작업이 필요하다. 그래서 "''ExexStart=''" 같은 라인이 생기는 것이다. 저것이 없으면 에.
  
-<code>+<code bash>
 $ sudo systemctl cat resilio-sync.service $ sudo systemctl cat resilio-sync.service
  
줄 1091: 줄 952:
 User=changwoo User=changwoo
 Group=changwoo Group=changwoo
 +PIDFile=
 PIDFile=/home/changwoo/.config/resilio-sync/sync.pid PIDFile=/home/changwoo/.config/resilio-sync/sync.pid
 +ExecStartPre=
 ExecStartPre=/bin/mkdir -p /home/changwoo/.config/resilio-sync ExecStartPre=/bin/mkdir -p /home/changwoo/.config/resilio-sync
-ExecStart=/bin/chown -R changwoo:changwoo /home/changwoo/.config/resilio-sync+ExecStartPre=/bin/chown -R changwoo:changwoo /home/changwoo/.config/resilio-sync 
 +ExecStart=
 ExecStart=/usr/bin/rslsync --config /home/changwoo/.config/resilio-sync/config.json ExecStart=/usr/bin/rslsync --config /home/changwoo/.config/resilio-sync/config.json
 +
  
 </code> </code>
줄 1100: 줄 965:
 이렇게 덧붙여지는 것을 참고하자. 이렇게 덧붙여지는 것을 참고하자.
  
-</code> + 
-</code>+===== SSL 설비 ===== 
 +이제는 필수로 구비하자. Let's Encrypt가 있다. 아래의 가이드를 따라하면 어렵지 않다. 
 +  * https://certbot.eff.org/#ubuntuxenial-nginx 
 +  * http://riseshia.github.io/2016/10/16/certbot-let-s-encrypt.html 
 +3개월마다 갱신해야 하는데, 나는 아직 자동 갱신을 하지는 않았다. 나중에 확인하고 달아 보도록 하자.
  
  
miniserver/xenial.1500857298.txt.gz · 마지막으로 수정됨: 2017/07/24 00:48 저자 changwoo

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki