Nginx config for staging application

resolver 172.17.0.1;
resolver_timeout 10s;

server {
    listen 80;

    server_name staging.app.com;

    charset utf-8;
    gzip_vary on;
    access_log /var/log/nginx/app.access.log;
    error_log /var/log/nginx/app.error.log;
    add_header 'Access-Control-Allow-Origin' '*' always;
    add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE' always;
    add_header X-Frame-Options "SAMEORIGIN";
    set $appweb http://app-web.service.consul;
    location / {
        proxy_pass $appweb:5002;
        proxy_redirect     off;
        proxy_set_header   Host $host;
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Host $server_name;
        auth_basic "Private Property";
        auth_basic_user_file /tmp/.htpasswd;
        #allow xxx.xxx.xxx.xxx; # xxx
        #deny all;
    }
}

Leave a Reply

Your email address will not be published. Required fields are marked *