เพิ่มประสิทธิภาพเว็บไซต์แบบคงที่สำหรับการโฮสต์ใน S3 โดยการรวมลายนิ้วมือไว้ในชื่อไฟล์ของสินทรัพย์ทั้งหมด เว็บไซต์ที่ได้รับการปรับปรุงจะถูกอัปโหลดไปยังบัคเก็ต S3 ที่ระบุพร้อมกับส่วนหัวแคชที่ถูกต้อง
คุณสามารถติดตั้งเวอร์ชันเสถียรได้โดยใช้คำสั่ง pip ต่อไปนี้:
pip install --upgrade s3-site-cache-optimizer
หากคุณต้องการติดตามคุณสมบัติล่าสุด ให้ติดตั้งเวอร์ชันการพัฒนา:
pip install --upgrade https://github.com/novemberfiveco/s3-site-cache-optimizer/archive/develop.zip
เครื่องมือบรรทัดคำสั่งดำเนินการตามขั้นตอนต่อไปนี้:
การดำเนินการไฟล์ทั้งหมดจะดำเนินการในไดเร็กทอรีเอาต์พุต (ชั่วคราว) ไดเร็กทอรีต้นทางจะไม่ถูกเปลี่ยนแปลง
สินทรัพย์ และ การเขียนซ้ำ ได้รับการยอมรับตามนามสกุลไฟล์ ปัจจุบันนามสกุลไฟล์ต่อไปนี้ถือเป็น ทรัพย์สิน :
ไฟล์ ที่เขียนซ้ำได้ คือไฟล์ข้อความที่มีนามสกุลใดนามสกุลหนึ่งต่อไปนี้:
ยื่นคำขอคุณสมบัติหากคุณต้องการดูนามสกุลไฟล์อื่นที่เพิ่ม
usage: s3-site-cache-optimizer [-h] [--debug] [--version]
[--exclude PATTERN [PATTERN ...]]
[-o OUTPUT_DIR]
[--access-key AWS_ACCESS_KEY_ID]
[--secret-key AWS_SECRET_ACCESS_KEY]
[--region REGION]
[--gzip]
[--prefix PREFIX]
[--domains DOMAIN [DOMAIN ...]]
[--skip-s3-upload]
source_dir destination_bucket
positional arguments:
source_dir Local directory containing a static website.
destination_bucket S3 bucket name.
optional arguments:
-h, --help show this help message and exit
--debug Enable debug output
--version show program's version number and exit
--exclude PATTERN [PATTERN ...]
Exclude files and directories matching these patterns.
-o OUTPUT_DIR, --output OUTPUT_DIR
Output directory in which local files are written.
When absent a temporary directory is created and used.
--access-key AWS_ACCESS_KEY_ID
AWS access key. If this field is not specified,
credentials from environment or credentials files will
be used.
--secret-key AWS_SECRET_ACCESS_KEY
AWS access secret. If this field is not specified,
credentials from environment or credentials files will
be used.
--region REGION AWS region to connect to.
--gzip Gzip text-based files.
--prefix PREFIX Subdirectory in which files are stored in the bucket.
Stored in the root of the bucket by default.
--domains DOMAIN [DOMAIN ...]
Domain names on which the site will be hosted.
--skip-s3-upload Skip uploading to S3.
$ s3-site-cache-optimizer ~/srv/www.example.com www.example.com --access-key XXXXXNOVEMBERFIVEXXXXX --secret-key XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
$ s3-site-cache-optimizer ~/srv/www.example.com www.example.com --exclude ".git/*" ".git*" --region eu-west-1
$ s3-site-cache-optimizer ~/srv/www.example.com www.example.com --output ~/srv/example-optimized/ --skip-s3-upload
$ s3-site-cache-optimizer ~/srv/www.example.com my_bucket --domains www.example.com example.com --prefix "user/sites/www.example.com"
s3-site-cache-optimizer เปิดตัวภายใต้ใบอนุญาต MIT