Stackoverflowers. I have a problem with my Rails nginx configuration. I am running a Rails 3.0.12 application and I am completely new to nginx.
I cannot get nginx to serve static assets. For each request in the /public
folder, I get 404. I am sending the nginx configuration that I have received so far. Maybe I missed something.
nginx.conf
:
user rails; worker_processes 1; daemon off; error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; events { worker_connections 2048; } http { include /etc/nginx/mime.types; default_type application/octet-stream; access_log /var/log/nginx/access.log; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; gzip on; gzip_http_version 1.0; gzip_comp_level 2; gzip_proxied any; gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript; server_names_hash_bucket_size 64; include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; }
sites-enabled/project.conf
:
upstream project { # fail_timeout=0 means we always retry an upstream even if it failed # to return a good HTTP response (in case the Unicorn master nukes a # single worker for timing out). # for UNIX domain socket setups: server unix:/tmp/project.socket fail_timeout=0; } server { listen 80; root /srv/www/project/current/public; passenger_enabled on; server_name dev.project.eu; server_name *.dev.project.eu; location / { #all requests are sent to the UNIX socket proxy_pass http:
I tried to remove the location /
block from project.conf
, but did nothing, the assets are still not visible.
I am also aware of the serve_static_assets
switch in Rails, but I would prefer nginx to serve these assets since it should do this.
source share