How to combine squid reverse proxy with nginx proxy for shiny-server
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
Solution 1:
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.