Skip to main content

Customizing NGINX configuration

Comments

3 comments

  • cPRex Jurassic Moderator

    Hey there!  I wouldn't expect the user block to be able to override the / location, as that would apply to all users on the system.  Can you try narrowing that path down for the user a bit and see if that passes the test?

    0
  • Dimitris Andrikopoulos

    My main configuration file "/etc/nginx/conf.d/users/myuser.conf", that is automatically generated, includes the below block:

        location / {
            proxy_cache $CPANEL_PROXY_CACHE;
            proxy_no_cache $CPANEL_SKIP_PROXY_CACHING;
            proxy_cache_bypass $CPANEL_SKIP_PROXY_CACHING;

            proxy_cache_valid 200 12d;
            proxy_cache_valid 301 12d;
            proxy_cache_valid 302 12d;
            proxy_cache_use_stale error timeout http_429 http_500 http_502 http_503 http_504;
            proxy_cache_background_update on;
            proxy_cache_revalidate on;
            proxy_cache_min_uses 1;
            proxy_cache_lock off;

            include conf.d/includes-optional/cpanel-proxy.conf;
            proxy_pass $CPANEL_APACHE_PROXY_PASS;
        }

    How can I override the above directives with the following ones?

        location / {
            proxy_pass http://127.0.0.1:6081;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto https;
            proxy_set_header X-Forwarded-Port 443;
            proxy_set_header Host $host;
        }
    0
  • cPRex Jurassic Moderator

    Thanks for the additional details.  It is my understanding that this isn't possible - in order to change the main block for a user you would have to edit and customize the nginx template, but that would make the change globally for all users.

    0

Please sign in to leave a comment.