【发布时间】:2023-10-20 18:49:01
【问题描述】:
我想在我的 nginx 和 unicorn 中激活 gzip 压缩:
我在 config/unicorn.rb:
的 rails 应用中有这个working_directory "/home/user/project.com/current"
shared_path = '/home/user/project.com/shared'
pid "#{shared_path}/pids/unicorn.pid"
stderr_path "#{shared_path}/log/unicorn.log"
stdout_path "#{shared_path}/log/unicorn.log"
listen '/tmp/unicorn.project.sock'
worker_processes 2
timeout 30
我的 nginx.conf 在我的 rails 应用程序中有这个:
upstream unicorn {
server unix:/tmp/unicorn.project.sock fail_timeout=0;
}
server {
listen 80 default;
root ~/project.com/current/public;
try_files $uri/index.html $uri @unicorn;
location @unicorn {
proxy_pass http://unicorn;
}
error_page 500 502 503 504 /500.html;
}
我怎样才能启用这个配置,比如:
gzip_static on;
expires max;
add_header Cache-Control public;
谢谢!
【问题讨论】:
标签: deployment nginx unicorn