Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can proxy_caching in nginx cause problems with parse? #1780

Closed
benishak opened this issue May 13, 2016 · 1 comment
Closed

can proxy_caching in nginx cause problems with parse? #1780

benishak opened this issue May 13, 2016 · 1 comment

Comments

@benishak
Copy link
Contributor

Env

  • ParseServer 2.2.9 (running with pm2)
  • AWS EC2 (CentOS + NGINX)

Question

I just enabled caching on my nginx, can this cause any problem ? Here is my nginx.conf

user  nginx;
worker_processes  2;
worker_rlimit_nofile 30000;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}

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/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    client_body_buffer_size             10K;
    client_header_buffer_size           1k;
    client_max_body_size                8m;
    large_client_header_buffers 2 1k;

    keepalive_timeout           15;
    client_body_timeout         12;
    client_header_timeout       12;
    send_timeout                10;

    gzip  on;
    gzip_comp_level  2;
    gzip_min_length  1000;
    gzip_proxied     expired no-cache no-store private auth;
    gzip_types       text/plain application/x-javascript text/xml text/css application/xml application/javascript;


    proxy_cache_path /var/lib/nginx/cache levels=1:2 keys_zone=backcache:8m max_size=50m;
    proxy_cache_key "$scheme$request_method$host$request_uri$is_args$args";
    proxy_cache_valid 200 302 10m;
    proxy_cache_valid 404 1m;

    # pm2
    server {

        server_name app.server.com;

        location / {
           proxy_pass http://localhost:9000;
           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;
       }
    }

    upstream api {
        least_conn;
        server IP:8080        weight=1 max_fails=1;
        server IP:8080       weight=1 max_fails=1;
    }

    # parse-production
    server {

        server_name api.server.com;

        proxy_buffering off;
        proxy_buffer_size 4k;

        location / {

           proxy_cache backcache;
           proxy_cache_bypass $http_cache_control;
           add_header X-Proxy-Cache $upstream_cache_status;

           proxy_pass http://api;
           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;
        }
    }

    #include /etc/nginx/conf.d/*.conf;
}
@flovilmart
Copy link
Contributor

I believe this question would be better suited on stackoverflow or stackexchange. The issues here are meant for reporting issues on parse-server.

If you encounter any problem with that configuration, please open another issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants