갤러리 프로그램을 대체하기 위해서 미디어위키 확장을 찾아보았으나, 아직까지는 마음에 드는 것이 없습니다. 그래서 리눅스에서 공개되어 있는 갤러리 프로그램 중에 piwigo를 설치해 보고자 합니다.
데이터베이스 구성
Piwigo에 사용할 데이터베이스와 사용자 및 권한 설정을 합니다.
- sudo mysql -u root -p
MariaDB [(none)]> CREATE DATABASE piwigo;
MariaDB [(none)]> CREATE USER piwigouser@localhost IDENTIFIED BY 'Piwigo_password';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON piwigo.* TO piwigouser@localhost;
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit
설치
- cd /var/www/html/
- sudo curl -o piwigo.zip http://piwigo.org/download/dlcounter.php?code=latest
- sudo unzip piwigo.zip
- sudo rm piwigo.zip
Nginx 설정
웹 서버에서 접근가능하도록 경로를 /etc/nginx/site-available/default에 만듭니다.
location /piwigo {
# auth_basic "Restricted";
# auth_basic_user_file /etc/nginx/mypasswd;
root /var/www/html;
index index.html index.htm index.php;
location ~ ^/piwigo/(config\.php|common\.php|includes|cache|files|store|images/avatars/upload) {
deny all;
internal;
}
location ~ ^/piwigo/(.+\.php)$ {
#try_files $uri =404;
try_files $uri @piwigohandler;
root /var/www/html;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
location ~* ^/piwigo/(.+\.(gif|jp?eg|png|css|js|cgi|pl|ico|swf|flv|s?html|php|xap|py|xml|txt))$ {
#access_log off;
#log_not_found off;
#expires 360d;
expires 1y;
root /var/www/html;
}
#CatchAll - last generates 301 moved permanently
location ~ ^/piwigo/.+$ {
#try_files $uri @phpBBhandler;
rewrite ^ /piwigo last;
}
}
location @piwigohandler {
rewrite ^ /piwigo last;
}
소유자/권한
이 부분은 확인이 필요해 보입니다.
- sudo chown www-data:root _data local plugins themes upload
- sudo chmod 755 _data local plugins themes upload
- cd local
- sudo chown www-data:root config css language
- sudo chmod 755 config css language
- sudo chmod 644 index.php
- cd config
- sudo chmod 644 *
- cd ../css
- sudo chmod 644 *
- cd ../language
- sudo chmod 644 *
설치 후에 기본 아이콘이 제대로 표시가 되지 않아 사용하는 것이 원활하지 않습니다.