我的 Rails 应用程序使用 ImageMagick,但该应用程序在尝试执行 ImageMagick 命令(“识别”)时失败。通过在我的 Apache 配置中传递以下环境变量,我在开发中解决了这个问题(我正在运行 Apache/Passenger):
SetEnv MAGICK_HOME /opt/local/var/macports/software/ImageMagick/6.5.9-0_0+q16
SetEnv DYLD_LIBRARY_PATH /opt/local/var/macports/software/ImageMagick/6.5.9-0_0+q16/opt/local/lib
SetEnv PATH /usr/bin:/opt/local/var/macports/software/ImageMagick/6.5.9-0_0+q16/opt/local/bin
但是,我的生产环境正在运行 Nginx 和 Mongrel(不是我设置的),我不确定如何将这些变量传递给应用程序。我的 nginx.conf 文件目前如下:
# user and group to run as
user mouthbreather mouthbreather;
worker_processes 4;
# pid of nginx master process
pid /var/run/nginx.pid;
events {
worker_connections 8192;
use epoll;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/engineyard/nginx/access.log main;
error_log /var/log/engineyard/nginx/error.log notice;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_proxied any;
gzip_buffers 16 8k;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
include /etc/nginx/sites/*.conf;
}
所以我的问题是:
- 如何确定我的 MAGICK_HOME 在哪里生产?
- 如何通过 nginx.conf 将这些变量传递给应用程序?
谢谢!