1

Windows version: 10
Docker for Windows: 2.0.0.2 (30215)
Nginx: latest

Docker-compose.yml:

version: '3.7'
services:
    nginx:
        restart: always
        image: nginx:latest
        ports:
            - "8000:80"
        volumes:
            - ./domains:/var/www
            - ./modules/nginx/nginx.conf:/etc/nginx/nginx.conf
            - ./modules/nginx/sites-available:/etc/nginx/sites-available
        working_dir: /var/www

Nginx.conf:

worker_processes 2;

events {
    worker_connections 1024;
}

http {
    access_log off;
    error_log /var/log/nginx/error.log crit;
    keepalive_timeout 30;
    reset_timedout_connection on;
    sendfile on;
    tcp_nopush on;

    gzip on;
    gzip_proxied any;
    gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml;
    gzip_vary on;
    gzip_disable "msie6";

    include /etc/nginx/sites-available/*.conf;
}

Currently I have configuration files for two virtual hosts.

ares.test.conf:

server {
    listen 80;
    listen [::]:80;
    server_name ares.test www.ares.test;
    root /var/www/ares.test/html;
    index index.html index.htm;

    location / {
        try_files $uri $uri/ =404;
    }
}

uparty.test.conf:

server {
    listen 80;
    listen [::]:80;
    server_name uparty.test www.uparty.test;
    root /var/www/uparty.test/html;
    index index.html index.htm;

    location / {
        try_files $uri $uri/ =404;
    }
}

I also added these lines to /etc/hosts file:

127.0.0.1 ares.test
127.0.0.1 uparty.test

Problem is that nothing is working. I mean that if I enter http://ares.test in the browser's address bar, it says that the page is not found (For http://uparty.test is the same). However, if I type localhost:8000 it shows ares.test web page contents.

I am new to docker and nginx, so cannot resolve this problem alone. Thank you all in advance.

scetoaux
  • 1,269
  • 2
  • 12
  • 25

0 Answers0