ImgURL幫助文檔【安裝】:https://www.xiaoz.me/doc/doc-imgurl/install github:https://github.com/helloxz/imgurl 自2.x版本開始,ImgURL使用CodeIgniter框架開發,因此需要先配置偽靜態,並確保環境滿足以下要求。
- PHP >= 5.6
- PDO_SQLite
- GD2
- ImageMagick
- fileinfo
- pathinfo
配置偽靜態
Nginx
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~* \.(db3|json)$ {
deny all;
}
location ~* ^/(temp|upload|imgs|data|application|static|system)/.*.(php|php5)$ {
return 403;
}
環境配置安裝:
環境:軍哥lnmp一鍵搭建 安裝時php版本選擇5.6以上 安裝完成后,查看php拓展:
默認已經安裝了gd2,pdo_sqlite,還有pathfilo,則我們只需安裝下面這兩項:
由於fileinfo在lnmp一鍵安裝包中已經下載了,所以我們先安裝fileinfo拓展。
fileinfo拓展安裝
1、安裝
cd lnmp1.6/src/php-7.1.30/ext/fileinfo
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
安裝完成后
2、在php.ini中添加此拓展,
vim /usr/local/php/etc/php.ini
#添加:
extension = fileinfo.so
重啟php-fpm,
lnmp php-fpm restart
檢查fileinfo拓展添加是否成功,
添加fileinfo拓展成功!
2、imagickr拓展安裝
1、安裝ImageMagick
wget http://www.imagemagick.org/download/ImageMagick.tar.gz
tar xvfz ImageMagick.tar.gz
cd ImageMagick-7.0.8-61/
./configure --prefix=/usr/local/imagemagick
make && make install
2、安裝php imagick拓展
wget https://pecl.php.net/get/imagick-3.4.3RC3.tgz
tar zxvf imagick-3.4.3RC3.tgz
cd imagick-3.4.3RC3/
/usr/local/php/bin/phpize # 和上面安裝fileinfo拓展一樣
#ImageMagick 6.8以上版本目錄為/usr/local/include/ImageMagick-X,在configure之前先做下軟連接
ln -s /usr/local/imagemagick/include/ImageMagick-7 /usr/local/imagemagick/include/ImageMagick
./configure --with-php-config=/usr/local/php/bin/php-config --with-imagick=/usr/local/imagemagick
make && make install
3、修改php配置文件
修改php.ini文件,添加extension=imagick.so 重啟php-fpm
lnmp php-fpm restart
檢查imagick拓展添加是否成功,
imgurl圖床安裝
1、配置網站
imgurl.test是域名,要換成你自己的,注意”Enable PHP Pathinfo?“要先”y“。 然后網站配置好了,網站目錄在/home/wwwroot/imgurl.test。
2、下載網站源碼
wget https://github.com/helloxz/imgurl/archive/v2.3.tar.gz
tar zxvf v2.3.tar.gz
cd imgurl-2.3/
#拷貝網站源碼到網站目錄
cp -r * /home/wwwroot/imgurl.test/
#更改網站目錄權限
chown -R www:www /home/wwwroot/imgurl.test/
出錯報錯,忽視即可
chown: changing ownership of ‘/home/wwwroot/photos.wilks.site/.user.ini’: Operation not permitted3、
3、配置rewrite規則
vim /usr/local/nginx/conf/vhost/imgurl.test.conf
把上面的nginx的rewrite規則寫入到最后,之后保存退出。
保存退出后,重啟nginx,
lnmp nginx restart
4、完成圖床配置
打開瀏覽器,輸入網址”http://imgurl.test",
可以看到安裝環境檢測全部通過,然后點擊下一步,
輸入用戶名、密碼,點擊開始安裝,
安裝完成后,可以“返回首頁”或者“登錄后台”, 首頁,
后台,
到此安裝完成!