E
E
ex1s2018-02-25 02:59:53
Nginx
ex1s, 2018-02-25 02:59:53

How to set nginx cookies?

Good day. There are 3 cookies on the site, you need to set Expires 30 days for each. How to do it? What and where to insert? Attached config:

user apache;
worker_processes 1;

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] $host "$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;       
    proxy_buffers              512 8k;
    proxy_buffer_size          64k;

    proxy_next_upstream        off;
    proxy_intercept_errors     off;
    proxy_connect_timeout      90s;
    proxy_read_timeout         10m;
    proxy_send_timeout         10m;

    proxy_temp_file_write_size 64k;
    proxy_max_temp_file_size   0;

    client_header_buffer_size   16k;
    large_client_header_buffers 4 8k;
    client_max_body_size        128m;
    client_body_buffer_size     16k;
    client_header_timeout       10m;
    server_names_hash_max_size 1024;
    server_names_hash_bucket_size 1024;

    client_body_timeout         10m;
    send_timeout                10m;

    tcp_nopush      on;
    tcp_nodelay     on;
    server_tokens   off;
    gzip            on;
    gzip_static     on;
    gzip_comp_level 5;
    gzip_min_length 1024;

    server {
        server_name localhost;
   disable_symlinks if_not_owner;
        listen 80;
  include /etc/nginx/vhosts-includes/*.conf;
  location @fallback {
    error_log /dev/null crit;
    proxy_pass http://127.0.0.1:8080;
    proxy_redirect http://127.0.0.1:8080 /;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
        	proxy_set_header X-Forwarded-Secret XXX;
    access_log off ;

  }
    }
    server {
        server_name default;
        listen 5.1.1.1:443 ssl;
        rewrite ^(/manager/)$    https://$http_host/manager/ispmgr permanent;
        rewrite ^(/manager)$    https://$http_host/manager/ispmgr permanent;

        ssl_certificate      /usr/local/mgr5/etc/manager.crt;
        ssl_certificate_key  /usr/local/mgr5/etc/manager.key;
        ssl_session_cache    shared:SSL:10m;
        ssl_session_timeout  10m;
        set $mgr_proxy "https://5.1.1.1:1500";
        location ^~ /manimg/ {
                alias /usr/local/mgr5/skins/;
        }
        location ^~ /manager {
                proxy_pass $mgr_proxy;
                proxy_redirect $mgr_proxy /;
                proxy_set_header Host $host:$server_port;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Manager-Path /manager;
                proxy_set_header X-Forwarded-Secret XXX;
                chunked_transfer_encoding off;
        }
        location ^~ /mancgi/ {
                proxy_pass $mgr_proxy;
                proxy_redirect $mgr_proxy /;
                proxy_set_header Host $host:$server_port;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-Secret XXX;
                chunked_transfer_encoding off;
        }
    }
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/vhosts/*/*.conf;
}

PS Another question, how to delete any cookie? Thank you. I apologize for my "top" knowledge. :D

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question