amazon web services - Configure nginx cache in AWS Elastic Beanstalk -


i need change configuration of nginx reverse proxy in eb. in local environment have configured fine , working, when try change proxy_cache_path , other stuff, it's not working.

this local configuration (nginx.conf), important thing here proxy_cache_path , configure cache section :

#user  nobody; worker_processes  1;  #error_log  logs/error.log; #error_log  logs/error.log  notice; #error_log  logs/error.log  info;  #pid        logs/nginx.pid;   events {     worker_connections  1024; }   http {     include       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  logs/access.log  main;      sendfile        on;     #tcp_nopush     on;      #keepalive_timeout  0;     keepalive_timeout  65;      gzip  on;      proxy_cache_path /cache/nginx levels=1:2 keys_zone=cache_zone_name:10m;      server {         listen       80;         server_name  mydomain.app, www.mydomain.app;            #charset koi8-r;          #access_log  logs/host.access.log  main;          location / {             #root   html;             #index  index.html index.htm;              #config proxy inverse cache             proxy_pass http://localhost:3000;             proxy_http_version 1.1;             proxy_set_header upgrade $http_upgrade;             proxy_set_header connection 'upgrade';             proxy_set_header host $host;             proxy_cache_bypass $http_upgrade;              # add cache debugging header             add_header x-cache-status $upstream_cache_status;              # configure cache             proxy_cache        cache_zone_name;             proxy_cache_valid  1m;             proxy_cache_key    $scheme$host$request_uri;          }          #error_page  404              /404.html;          # redirect server error pages static page /50x.html         #         error_page   500 502 503 504  /50x.html;         location = /50x.html {             root   html;         }      }      include servers/*; } 

i have take official documentation , compare instances .ebextensions/proxy.config:

files:   /etc/nginx/conf.d/proxy.conf:     mode: "000644"     owner: root     group: root     content: |       upstream nodejs {         server 127.0.0.1:8081;         keepalive 256;       }        server {         listen 8080;         # proxy_cache_path /home levels=1:2 keys_zone=cache_zone_name:10m;         if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})t(\d{2})") {             set $year $1;             set $month $2;             set $day $3;             set $hour $4;         }         access_log /var/log/nginx/healthd/application.log.$year-$month-$day-$hour healthd;         access_log  /var/log/nginx/access.log  main;          location / {             proxy_pass  http://nodejs;             proxy_set_header   connection "";             proxy_http_version 1.1;             proxy_set_header        host            $host;             proxy_set_header        x-real-ip       $remote_addr;             proxy_set_header        x-forwarded-for $proxy_add_x_forwarded_for;              # add cache debugging header             add_header x-cache-status $upstream_cache_status;              # configure cache             # proxy_cache        cache_zone_name;             # proxy_cache_valid  1m;             # proxy_cache_key    $scheme$host$request_uri;         }          gzip on;         gzip_comp_level 4;         gzip_types text/html text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;          location /public {             alias /var/app/current/public;         }        }  container_commands:  removeconfig:     command: "rm -f /tmp/deployment/config/#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf /etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf" 

i have configured folder /home caching, , if uncomment lines of proxy_cache_path , configure cache section, deploy failed.

any ideas? have spent more 2 hours with no results... thanks!!

ok, solved moving line out of server:

 proxy_cache_path /home levels=1:2 keys_zone=cache_zone_name:10m;   server { ... other code } 

i hope question , answer. thanks!


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -