1
좋아, 그래서 (소켓 파일을 수신 대기하고 또한 레일스에서 정적 파일을 제공/공용 디렉토리) 유니콘 레일 서버를 제공하기위한 표준 nginx 설정을 꽤 많이했습니다.유니콘 레일 서버를 서비스 할 때 두 위치에서 정적 파일을 제공하는 nginx를 얻으려면 어떻게해야합니까?
- 가 (현재 완료 처럼)
- 다른 루트에서 URL/보고서/정적 파일 (제공 rails_app/대중 정적 파일을 제공 :
는 그러나, 나는 다음을 수행 할 등을/mnt/파일 /)
내가 내의 nginx의 설정에 다음을 추가하는 시도 :
location /reports/ {
root /mnt/matthew/web;
}
을
하지만 작동하지 않았습니다.
어떻게 이런 일이 발생할 수 있습니까?
(아래 내 전체 nginx.conf 파일입니다. 당신의 시도 파일 문이 location /reports/
파일을 일치하는 경우가 지정한 부모 루트의로,
worker_processes 1;
pid /tmp/nginx.pid;
error_log /tmp/nginx.error.log;
events {
worker_connections 1024; # increase if you have lots of clients
accept_mutex off; # "on" if nginx worker_processes > 1
# use epoll; # enable for Linux 2.6+
# use kqueue; # enable for FreeBSD, OSX
}
http {
# nginx will find this file in the config directory set at nginx build time
include mime.types;
# fallback in case we can't determine a type
default_type application/octet-stream;
# click tracking!
access_log /tmp/nginx.access.log combined;
sendfile on;
tcp_nopush on; # off may be better for *some* Comet/long-poll stuff
tcp_nodelay off; # on may be better for some Comet/long-poll stuff
gzip on;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 500;
gzip_disable "MSIE [1-6]\.";
gzip_types text/plain text/html text/xml text/css
text/comma-separated-values
text/javascript application/x-javascript
application/atom+xml;
# this can be any application server, not just Unicorn/Rainbows!
upstream app_server {
server unix:/home/matthew/server/tmp/unicorn.sock fail_timeout=0;
}
server {
# enable one of the following if you're on Linux or FreeBSD
listen 80 default deferred; # for Linux
# listen 80 default accept_filter=httpready; # for FreeBSD
client_max_body_size 4G;
server_name _;
keepalive_timeout 5;
location /reports/ {
root /mnt/matthew/web;
}
# path for static files
root /home/matthew/server/public;
try_files $uri/index.html $uri.txt $uri.html $uri @app;
location @app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_server;
}
# Rails error pages
error_page 500 502 503 504 /500.html;
location = /500.html {
root public;
}
}
}
은 어쩌면에/공공/otherstuff/홈/매튜/서버에서 소프트 링크에 대해 무엇을 바보 같은 옵션이지만,/mnt/files/루트 변경 문제를 피하려면? –