Piwigo 설치 · 5 min read · Jan 23, 2026
Debian Wheezy에서 Nginx로 Piwigo 갤러리 설치하기
Debian Wheezy에서 Nginx로 Piwigo 갤러리 설치하기
이 튜토리얼은 Debian Wheezy 시스템에서 vhosts에 맞게 구성된 nginx로 piwigo 갤러리 사이트를 설치하고 실행하는 방법을 보여줍니다. Piwigo는 많은 플러그인이 있는 갤러리 웹사이트입니다. 이 샘플에서는 vhost “gallery.domain.tld”를 구성합니다.
설치
nginx용 패키지 설치
apt-get install nginx php5-fpm php5 php5-mysql php5-pgsql php5-imap php-pear php5-sqlite php5-ldap php5-gd php5-imagick php5-curl php-apc
apt-get install php5-mcrypt php5-pspell php5-xmlrpc php5-xsl php5-cgi php-auth php-auth-sasl php-net-smtp
MySQL 서버 설치
apt-get install mysql-serverNginx 구성
기본 사이트 삭제 (선택 사항)
rm -f /etc/nginx/sites-enabled/defaultvhosts용 템플릿 파일 생성
cd /etc/nginx/sites-available/
touch template-with-ssl
touch template
ssl 지원 vhost
파일에 다음을 삽입합니다.
nano /etc/nginx/sites-available/template-with-sslserver {
listen 80;
# .domain.com은 domain.com과 anything.domain.com 모두와 일치합니다.
server_name www.domain.tld domain.tld;
rewrite ^ https://$server_name$request_uri? permanent;
# 서버 블록의 루트를 서버 수준에 두는 것이 가장 좋으며, 위치 수준에 두지 않아야 합니다.
# 모든 위치 블록 경로는 이 루트에 상대적입니다.
root /var/www/www.domain.tld;
# 로그를 설정하는 것이 항상 좋습니다. 그러나 오류 로그를 끌 수는 없습니다.
# error_log off;를 설정하면 'off'라는 파일이 생성됩니다.
access_log /var/log/nginx/example.access.log;
error_log /var/log/nginx/example.error.log;
# 이것은 http { } 수준에서도 사용할 수 있습니다.
index index.html index.htm index.php;
location / {
# 워드프레스를 사용하고 추가 리라이트를 원하지 않는 경우
# @rewrites라는 단어를 /index.php로 교체합니다.
try_files $uri $uri/ @rewrites;
}
location @rewrites {
# 여기에 자신의 리라이트 규칙을 넣을 수 있습니다.
# 예를 들어 rewrite ^/~(.*)/(.*)/? /users/$1/$2 last;
# 아무것도 일치하지 않으면 /index.php로 보냅니다.
rewrite ^ /index.php last;
}
# 이 블록은 이미지, css, js와 같은 정적 파일 요청을 잡습니다.
# ?: 접두사는 '비포획' 마크로, 패턴이 $1에 캡처될 필요가 없음을 의미합니다. 이는 성능 향상에 도움이 됩니다.
location ~* \\.(?:ico|css|js|gif|jpe?g|png)$ {
# 정적 파일을 브라우저로 전송하기 위한 기본 캐시 제어
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
# 워드프레스의 가상 robots.txt를 사용하려면 robots 줄을 제거합니다.
location = /robots.txt { access_log off; log_not_found off; }
location = /favicon.ico { access_log off; log_not_found off; }
# 이로 인해 숨겨진 파일(점으로 시작하는 파일)이 제공되지 않습니다.
location ~ \\. { access_log off; log_not_found off; deny all; }
location ~ \.php {
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
}
}
# ssl-vhost를 사용하려면
server {
listen 443 default ssl;
# .domain.com은 domain.com과 anything.domain.com 모두와 일치합니다.
server_name www.domain.tld domain.tld;
ssl_certificate /etc/nginx/ssl/www.domain.tld.crt;
ssl_certificate_key /etc/nginx/ssl/www.domain.tld.key;
# 서버 블록의 루트를 서버 수준에 두는 것이 가장 좋으며, 위치 수준에 두지 않아야 합니다.
# 모든 위치 블록 경로는 이 루트에 상대적입니다.
root /var/www/www.domain.tld;
# 로그를 설정하는 것이 항상 좋습니다. 그러나 오류 로그를 끌 수는 없습니다.
# error_log off;를 설정하면 'off'라는 파일이 생성됩니다.
access_log /var/log/nginx/example.access.log;
error_log /var/log/nginx/example.error.log;
# 이것은 http { } 수준에서도 사용할 수 있습니다.
index index.html index.htm index.php;
location / {
# 워드프레스를 사용하고 추가 리라이트를 원하지 않는 경우
# @rewrites라는 단어를 /index.php로 교체합니다.
try_files $uri $uri/ @rewrites;
}
location @rewrites {
# 여기에 자신의 리라이트 규칙을 넣을 수 있습니다.
# 예를 들어 rewrite ^/~(.*)/(.*)/? /users/$1/$2 last;
# 아무것도 일치하지 않으면 /index.php로 보냅니다.
rewrite ^ /index.php last;
}
# 이 블록은 이미지, css, js와 같은 정적 파일 요청을 잡습니다.
# ?: 접두사는 '비포획' 마크로, 패턴이 $1에 캡처될 필요가 없음을 의미합니다. 이는 성능 향상에 도움이 됩니다.
location ~* \\.(?:ico|css|js|gif|jpe?g|png)$ {
# 정적 파일을 브라우저로 전송하기 위한 기본 캐시 제어
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
# 워드프레스의 가상 robots.txt를 사용하려면 robots 줄을 제거합니다.
location = /robots.txt { access_log off; log_not_found off; }
location = /favicon.ico { access_log off; log_not_found off; }
# 이로 인해 숨겨진 파일(점으로 시작하는 파일)이 제공되지 않습니다.
location ~ \\. { access_log off; log_not_found off; deny all; }
location ~ \.php {
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
}
}HTTP 전용 vhost
nano /etc/nginx/sites-available/templateserver {
listen 80;
# .domain.com은 domain.com과 anything.domain.com 모두와 일치합니다.
server_name www.domain.tld domain.tld;
#rewrite ^ https://$server_name$request_uri? permanent;
# 서버 블록의 루트를 서버 수준에 두는 것이 가장 좋으며, 위치 수준에 두지 않아야 합니다.
# 모든 위치 블록 경로는 이 루트에 상대적입니다.
root /var/www/www.domain.tld;
# 로그를 설정하는 것이 항상 좋습니다. 그러나 오류 로그를 끌 수는 없습니다.
# error_log off;를 설정하면 'off'라는 파일이 생성됩니다.
access_log /var/log/nginx/rugia.access.log;
error_log /var/log/nginx/rugia.error.log;
# 이것은 http { } 수준에서도 사용할 수 있습니다.
index index.html index.htm index.php;
location / {
# 워드프레스를 사용하고 추가 리라이트를 원하지 않는 경우
# @rewrites라는 단어를 /index.php로 교체합니다.
try_files $uri $uri/ @rewrites;
}
location @rewrites {
# 여기에 자신의 리라이트 규칙을 넣을 수 있습니다.
# 예를 들어 rewrite ^/~(.*)/(.*)/? /users/$1/$2 last;
# 아무것도 일치하지 않으면 /index.php로 보냅니다.
rewrite ^ /index.php last;
}
# 이 블록은 이미지, css, js와 같은 정적 파일 요청을 잡습니다.
# ?: 접두사는 '비포획' 마크로, 패턴이 $1에 캡처될 필요가 없음을 의미합니다. 이는 성능 향상에 도움이 됩니다.
location ~* \\.(?:ico|css|js|gif|jpe?g|png)$ {
# 정적 파일을 브라우저로 전송하기 위한 기본 캐시 제어
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
# 워드프레스의 가상 robots.txt를 사용하려면 robots 줄을 제거합니다.
location = /robots.txt { access_log off; log_not_found off; }
location = /favicon.ico { access_log off; log_not_found off; }
# 이로 인해 숨겨진 파일(점으로 시작하는 파일)이 제공되지 않습니다.
location ~ \\. { access_log off; log_not_found off; deny all; }
location ~ \.php {
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
}
}첫 번째 vhost 생성
템플릿 사용
cp /etc/nginx/sites-available/template /etc/nginx/sites-available/gallery.domain.tld경로 변수 편집
nano /etc/nginx/sites-available/gallery.domain.tldserver_name gallery.domain.tld;
root /var/www/gallery.domain.tld;
access_log /var/log/nginx/gallery.access.log;
error_log /var/log/nginx/gallery.error.log;디렉토리 구조 생성
mkdir -p /var/www/gallery.domain.tld
chown -R www-data:www-data /var/www
vhost 활성화
ln -s /etc/nginx/sites-available/gallery.domain.tld /etc/nginx/sites-enabled/gallery.domain.tld이제 서비스를 재시작합니다:
/etc/init.d/php5-fpm restart
/etc/init.d/nginx restart
PHP 테스트
phpinfo로 테스트 파일 생성:
nano /var/www/gallery.domain.tld/test.php
빠른 테스트를 위해 vhost 이름으로 hosts 파일을 편집합니다; 이 샘플에서 서버의 IP는
192.168.1.10 입니다:
192.168.1.10 gallery.domain.tld이제 브라우저를 열고 다음으로 이동합니다:
http://gallery.domain.tld설치된 php 버전에 대한 정보 페이지가 보이면 모든 것이 정상입니다. 이제 테스트 파일을 삭제할 수 있습니다:
rm -f nano /var/www/gallery.domain.tld/test.php Piwigo 구성
데이터베이스 및 사용자 생성
사용자 이름: gallery01
비밀번호: PASSWORD
MySQL에 연결:
mysql -u root -pcreate database gallery01; grant all on gallery01.* to ‘gallery’@’localhost’ identified by ‘PASSWORD’; flush privileges; \q;
Piwigo용 netinstall 파일 다운로드
cd /var/www/gallery.domain.tld
wget http://piwigo.org/download/dlcounter.php?code=netinstall
mv dlcounter.php\?code\=netinstall netinstall.php
chown www-data:www-data netinstall.php
구성 조정
nano /etc/php5/fpm/php.ini upload_tmp_dir = /tmp
upload_max_filesize = 20M
max_file_uploads = 20nano /etc/nginx/nginx.conf client_max_body_size 20M;
client_body_buffer_size 128k;서비스를 재시작하는 것을 잊지 마세요:
/etc/init.d/php5-fpm restart
/etc/init.d/nginx restart
웹 설치 프로그램 사용
브라우저를 열고 다음으로 이동합니다:
새 게시물을 받은 편지함에서 받기
스팸은 없습니다. 언제든지 구독 해지 가능합니다.