I have a nginx web server which acts as a proxy for my shiny-server. I now want to use a squid reverse proxy to provide access to the nginx server (and thus the shiny server) to internet clients. Currently, I can access the nginx server (and thus the shiny-server) through a web browser on my local network.

My objective is to configure the Squid & Nginx instances such that they can pass traffic between them.

nginx.conf (edited for brevity):

server {
    listen       80 default_server;
    return       301 https://$host$request_uri;

server {

    listen       443 ssl http2 default_server;
    listen       [::]:443 ssl http2 default_server;
    server_name  _;
    root         /path/to/server/directory;

    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;

    location / {
        proxy_pass http://localhost:3838;
        proxy_redirect / $scheme://$http_host/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        proxy_read_timeout 20d;
        proxy_buffering off;

squid.conf (edited for brevity):

cache_peer shiny.domain.com parent 80 0 no-query originserver name=shinyHost login=PASS
acl shinyACL dstdomain shiny.domain.com
cache_peer_access shinyHost allow shinyACL
http_access allow shinyACL

You don't need squid in reverse proxying mode with nginx, thus you shouldn't use it. If you want to cache anything that upstream gives your nginx - you should do it using nginx ngx_http_proxy_module by configuring what to cache.

| improve this answer | |
  • Squid is in front of nginx in this case. I want my Squid server to forward requests to the nginx server (which in turn is forwarding to the shiny-server). – Stringers Dec 17 '18 at 6:37
  • That was actually a typo. And no, you still don't want to. – drookie Dec 17 '18 at 6:38
  • The caching is not the feature I'm really looking for here. In my setup, I host many webservers via one IP address, which is handled by Squid. It is not an option to stop using Squid in this case as a lot of existing architecture relies on it. I do not have additional IPs. I need the nginx server as part of my authentication for the shiny-server (at this stage, I would like to change this at some point but can't right now.) – Stringers Dec 17 '18 at 6:47
  • You don't need any additional IPs. Unlimited number of virtual hosts can be hosted just on one IPs. OSes/browsers that don't support SNI are long-gone obsoleted legacy now. You see to be a hostage of wrong architectural solution, but you still don't need squid anyway. – drookie Dec 17 '18 at 6:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.