Web 관리 · 5 min read · Feb 14, 2026

우분투 16.04에서 sitecopy로 원격 웹 사이트 유지 관리하기

sitecopy는 로컬에 저장된 웹 사이트를 원격 웹 서버(FTP 또는 WebDAV 사용)로 복사하는 도구입니다. 수정된 로컬 파일을 업로드하고 로컬 컴퓨터에서 삭제된 원격 파일을 삭제하여 원격 사이트를 로컬 복사본과 동기화 상태로 유지하는 데 도움을 줍니다. 이 튜토리얼에서는 sitecopy를 사용하여 로컬 우분투 16.04 데스크탑에서 원격 웹 사이트를 관리하는 방법을 보여줍니다.

1 사전 참고

저는 로컬 우분투 데스크탑에서 사용자 이름이 till인 계정을 사용하고 있습니다(해당 사용자로 로컬 리눅스 데스크탑에 로그인했습니다 - root로 로그인하지 마세요). 원격 웹 사이트 example.com의 파일은 로컬 컴퓨터의 /home/till/sites/example.com/ 디렉토리에 저장되어 있습니다. 원격 문서 루트는 /var/www/example.com/web/입니다.

sitecopy는 FTP와 WebDAV를 사용할 수 있으므로 원격 서버에 FTP 또는 WebDAV 계정이 있어야 합니다. 저는 여기서 FTP 사용자 이름 defaulttill과 비밀번호 howtoforge를 사용하고 있습니다.

이 예제에 사용하는 원격 웹 사이트는 ISPConfig로 생성되었습니다. 그러나 FTP 또는 WebDAV 접근 권한이 있는 모든 사이트에서 작동합니다.

2 sitecopy 설치하기

sitecopy는 다음과 같이 로컬 데스크탑에 설치할 수 있습니다(루트 권한이 필요하므로 sudo를 사용합니다):

sudo apt-get -y install sitecopy

이제 sitecopy의 매뉴얼 페이지를 살펴보아 옵션에 익숙해지세요:

man sitecopy

3 sitecopy 구성하기

로컬 데스크탑의 홈 디렉토리로 이동하세요…

cd ~

… 그리고 700 권한으로 .sitecopy 디렉토리를 생성합니다(사이트 복사본의 파일 세부 정보를 저장하기 위해 sitecopy가 이 디렉토리를 사용합니다):

mkdir -m 700 .sitecopy

다음으로, sitecopy 구성 파일 .sitecopyrc를 생성합니다:

touch .sitecopyrc  
chmod 600 .sitecopyrc

파일을 열어보세요…

nano .sitecopyrc

… 그리고 example.com 사이트에 대한 구성을 입력하세요. FTP에 대한 두 가지 예는 다음과 같습니다…

site example.com
  server example.com
  username defaulttill
  password howtoforge
  local /home/till/sites/example.com/
  remote ~/web/
  exclude *.bak
  exclude *~

… 그리고 WebDAV에 대한 예:

site example.com
  server example.com
  protocol webdav
  username defaulttill
  password howtoforge
  local /home/till/sites/example.com/
  remote /var/www/example.com/web/
  exclude *.bak
  exclude *~

(사이트 복사본으로 관리할 각 웹 사이트에 대한 구문을 정의할 수 있습니다.)

site 지시문 뒤에는 웹 사이트의 이름이 와야 합니다 - 예를 들어 example.com 또는 mysite와 같이 자유롭게 선택할 수 있습니다. 이 이름은 나중에 sitecopy 명령에서 사용됩니다. 해당 사이트에 속하는 다음 구성 옵션은 들여쓰기를 해야 합니다!

다음 구성 옵션의 대부분은 자명합니다. 기본 프로토콜은 FTP입니다. WebDAV를 사용하려면 protocol webdav를 지정하세요. local 지시문은 웹 사이트 복사본의 로컬 경로를 포함하고, remote는 원격 서버의 웹 사이트 경로를 포함합니다 - 절대 경로 또는 상대 경로일 수 있습니다. 사용자가 chroot된 경우(FTP 사용자에게 일반적인 경우), 상대 경로(예: ~/ 또는 ~/web)를 사용해야 합니다. 그렇지 않으면 절대 경로를 사용하세요.

exclude 라인은 선택 사항이며, sitecopy가 유지 관리하지 않을 파일을 제외하는 방법을 보여주기 위해 여기에 있습니다.

sitecopy 구성에 대한 자세한 내용은 매뉴얼 페이지에서 확인할 수 있습니다:

man sitecopy

4 첫 사용

sitecopy를 처음 사용하기 전에 다음 세 가지 시나리오 중 어떤 것이 귀하의 상황에 맞는지 결정해야 합니다:

  1. 기존 원격 사이트와 로컬 복사본, 둘 다 동기화됨.
  2. 기존 원격 사이트, 로컬 복사본 없음.
  3. 새로운 원격 사이트, 기존 로컬 복사본.

4.1 기존 원격 사이트와 로컬 복사본, 둘 다 동기화됨

원격 사이트와 로컬 복사본이 모두 존재하고 동기화되어 있다면,

sitecopy --catchup example.com

을 실행하여 sitecopy가 로컬 사이트가 원격 복사본과 정확히 동일하다고 생각하게 만듭니다. .sitecopyrc 파일에서 사용하는 사이트 이름으로 example.com을 교체하세요.

till@ubuntu-desktop:~$ sitecopy --catchup example.com  
sitecopy: Catching up site `example.com' (on example.com in ~/web/)  
sitecopy: All the files and and directories are marked as updated remotely.

4.2 기존 원격 사이트, 로컬 복사본 없음

기존 원격 웹 사이트의 로컬 복사본이 없다면,

sitecopy --fetch example.com

을 먼저 실행하여 sitecopy가 원격 서버에서 파일 목록을 가져오게 합니다(예: .sitecopyrc 파일에서 사용하는 사이트 이름으로 example.com을 교체하세요):

till@ubuntu-desktop:~$ sitecopy --fetch example.com  
sitecopy: Fetching site `example.com' (on example.com in ~/web/)  
File: error/503.html - size 1906  
File: error/502.html - size 1881  
File: error/500.html - size 1851  
File: error/405.html - size 1810  
File: error/404.html - size 1806  
File: error/403.html - size 1809  
File: error/401.html - size 1806  
File: error/400.html - size 1792  
File: stats/.htaccess - size 128  
File: robots.txt - size 14  
File: index.html - size 1861  
File: favicon.ico - size 7358  
File: .htaccess - size 26  
Directory: error/  
Directory: stats/  
sitecopy: Fetch completed successfully.

그런 다음,

sitecopy --synch example.com

을 실행하여 원격 복사본에서 로컬 사이트를 업데이트합니다.

sitecopy: Synchronizing site `example.com' (on example.com in ~/web/)  
Creating error/: done.  
Creating stats/: done.  
Downloading error/503.html: [.] done.  
Downloading error/502.html: [.] done.  
Downloading error/500.html: [.] done.  
Downloading error/405.html: [.] done.  
Downloading error/404.html: [.] done.  
Downloading error/403.html: [.] done.  
Downloading error/401.html: [.] done.  
Downloading error/400.html: [.] done.  
Downloading stats/.htaccess: [.] done.  
Downloading robots.txt: [.] done.  
Downloading index.html: [.] done.  
Downloading favicon.ico: [.] done.  
Downloading .htaccess: [.] done.  
sitecopy: Synchronize completed successfully.

4.3 새로운 원격 사이트, 기존 로컬 복사본

로컬 복사본이 존재하지만 원격 사이트가 비어 있다면,

sitecopy --init example.com

을 먼저 실행하여 사이트를 초기화합니다. .sitecopyrc 파일에서 사용하는 사이트 이름으로 example.com을 교체하세요.

till@ubuntu-desktop:~$ sitecopy --init example.com  
sitecopy: Initializing site `example.com' (on example.com in ~/web/)  
sitecopy: All the files and directories are marked as NOT updated remotely.  
  

그런 다음,

sitecopy --update example.com

을 실행하여 로컬 복사본을 원격 사이트에 업로드합니다:

till@ubuntu-desktop:~$ sitecopy --update example.com  
sitecopy: Updating site `example.com' (on example.com in ~/web/)  
Creating stats/: done.  
Creating data/: done.  
Creating error/: done.  
Uploading stats/.htaccess: [.] done.  
Uploading data/index.html: [.] done.  
Uploading error/403.html: [.] done.  
Uploading error/401.html: [.] done.  
Uploading error/404.html: [.] done.  
Uploading error/503.html: [.] done.  
Uploading error/400.html: [.] done.  
Uploading error/502.html: [.] done.  
Uploading error/405.html: [.] done.  
Uploading error/500.html: [.] done.  
Uploading index.html: [.] done.  
Uploading robots.txt: [.] done.  
Uploading .htaccess: [.] done.  
Uploading favicon.ico: [.] done.  
sitecopy: Update completed successfully.

5 sitecopy 사용하기

그 후, sitecopy 사용은 정말 쉽습니다. 로컬 복사본으로 작업하고 파일을 업데이트, 생성 및 삭제할 수 있습니다. 첫 번째, 그러나 선택적인 단계는 다음을 실행하는 것입니다:

sitecopy example.com

로컬에서 변경된 파일을 찾기 위해(예: .sitecopyrc 파일에서 사용하는 사이트 이름으로 example.com을 교체하세요):

till@ubuntu-desktop:~$ sitecopy example.com  
sitecopy: Showing changes to site `example.com' (on example.com in ~/web/)  
* These items have been added since the last update:  
info.php  
sitecopy: The remote site needs updating (1 item to update).

원격 웹 사이트를 로컬 복사본과 동기화하려면(즉, 새로운 파일과 변경된 파일을 원격 서버에 업로드하고 로컬에서 삭제된 파일을 원격 서버에서 삭제하려면), 다음을 실행하면 됩니다:

sitecopy --update example.com
till@ubuntu-desktop:~$ sitecopy --update example.com  
sitecopy: Updating site `example.com' (on example.com in ~/web/)  
Uploading info.php: [] done.  
sitecopy: Update completed successfully.

그게 전부입니다! sitecopy와 함께 즐거운 시간 되세요!

6 링크

Share: X/Twitter LinkedIn

새 게시물을 받은 편지함에서 받기

스팸은 없습니다. 언제든지 구독 해지 가능합니다.