Last active
October 15, 2021 01:09
-
-
Save gesteves/4da1c4a98b756d84ed29 to your computer and use it in GitHub Desktop.
How to install Thumbor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First, install all of the things | |
apt-get update | |
apt-get install nginx | |
/etc/init.d/nginx start | |
apt-get install python-dev | |
apt-get install python-pip | |
apt-get install libjpeg-dev libpng-dev libtiff-dev libjasper-dev libgtk2.0-dev python-numpy python-pycurl libwebp-dev python-opencv libjpeg-progs | |
ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib | |
pip install pillow | |
pip install thumbor | |
easy_install supervisor | |
mkdir /home/logs | |
# Install JPEG Archive | |
sudo apt-get install build-essential autoconf pkg-config nasm libtool | |
git clone https://github.com/mozilla/mozjpeg.git | |
cd mozjpeg | |
autoreconf -fiv | |
./configure --with-jpeg8 | |
make | |
sudo make install | |
cd .. | |
git clone https://github.com/danielgtaylor/jpeg-archive.git | |
cd jpeg-archive | |
make | |
sudo make install | |
# Install thumbor-plugins | |
pip install https://github.com/thumbor/thumbor-plugins/archive/master.zip | |
# Then configure thumbor at /etc/thumbor.conf | |
import os | |
DETECTORS = [ | |
'thumbor.detectors.face_detector', | |
] | |
FILTERS = [ | |
'thumbor.filters.quality', | |
'thumbor.filters.no_upscale', | |
'thumbor.filters.blur', | |
'thumbor.filters.strip_icc', | |
'thumbor.filters.max_bytes', | |
] | |
OPTIMIZERS = [ | |
'thumbor_plugins.optimizers.jpegrecompress', | |
] | |
JPEGRECOMPRESS_PATH = '/usr/local/bin/jpeg-recompress' | |
ALLOW_UNSAFE_URL = False | |
AUTO_WEBP = True | |
MAX_AGE = 60 * 60 * 24 * 365 | |
QUALITY = 100 | |
RESPECT_ORIENTATION = True | |
PRESERVE_EXIF_INFO = True | |
SECURITY_KEY = 'putsomethinghere' | |
STORAGE = 'thumbor.storages.file_storage' | |
STORAGE_EXPIRATION_SECONDS = 60 * 60 * 24 * 365 | |
STORAGE_FILE_STORAGE_ROOT_PATH = '/tmp/thumbor/storage' | |
RESULT_STORAGE = 'thumbor.result_storages.file_storage' | |
RESULT_STORAGE_EXPIRATION_SECONDS = 60 * 60 * 24 * 365 | |
RESULT_STORAGE_FILE_STORAGE_ROOT_PATH = '/tmp/thumbor/result_storage' | |
# Then configure supervisor at /etc/supervisord.conf | |
[supervisord] | |
[program:thumbor] | |
command=thumbor --conf="/etc/thumbor.conf" --port=800%(process_num)s | |
process_name=thumbor800%(process_num)s | |
numprocs=4 | |
autostart=true | |
autorestart=true | |
startretries=3 | |
stopsignal=TERM | |
stdout_logfile=/home/logs/thumbor800%(process_num)s.stdout.log | |
stdout_logfile_maxbytes=1MB | |
stdout_logfile_backups=10 | |
stderr_logfile=/home/logs/thumbor800%(process_num)s.stderr.log | |
stderr_logfile_maxbytes=1MB | |
stderr_logfile_backups=10 | |
$ supervisord -c /etc/supervisord.conf | |
# Then configure nginx at /etc/nginx/sites-available/thumbor | |
upstream thumbor { | |
server 127.0.0.1:8000; | |
server 127.0.0.1:8001; | |
server 127.0.0.1:8002; | |
server 127.0.0.1:8003; | |
} | |
server { | |
listen 80; | |
server_name localhost; | |
location / { | |
proxy_pass http://thumbor; | |
} | |
} | |
# Then move the thumbor site to sites-enabled | |
$ ln -s /etc/nginx/sites-available/thumbor /etc/nginx/sites-enabled/thumbor | |
# Finally, start nginx | |
$ service nginx start |
gistfile1.txt: line 76: syntax error near unexpected token `('
how resolved this?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Many thanks!