-2

i want when i write 10.10.0.0 in browser, it takes me index page.but it doesnt I tried

server {
  listen 8080;
    server_name 10.10.0.0;
     return 301 http://localhost:8080/index.html;
    }
SitiSchu
  • 1,361
  • 11
  • 20
Elvin Jafarov
  • 41
  • 1
  • 1
  • 10

2 Answers2

0

I didn't have time to test, but try following

server {
  listen 8080;
  server_name 10.10.0.0;
  location / {
     return 301 http://localhost:8080/index.html;
  }
}
gelonida
  • 5,327
  • 2
  • 23
  • 41
0

Let us try to dissect it, Does this work without docker?

If yes, Let us look at what ports are you exposing to outside world from your container For example: in docker-compose you need to expose it like below,

NOTE: see "ports" NOT "expose", which tells: "For external world I am exposing 8080, from there I will route internally to port 80 in the container"

  nginx:
    build:
       context: ./nginx
       dockerfile: Dockerfile
    command: /usr/sbin/nginx -g 'daemon off;' -c /etc/nginx/nginx.conf
    container_name: my_nginx_server
    tty: true
    expose:
        - "80" #This is internal to container network
    ports:
     - "8080:80" #HOST:CONTAINER

if you are using command-line, then it should have "-p 8080:80" while running container

If it does not work without docker, check ngnix<-->uwsgi (or whatever) <-->your_app settings.

Please share more info, dockerfile, docker-compose.yml

drd
  • 575
  • 2
  • 8
  • version: "3" services: web: image: nginx build: . ports: - "8080:80" tty: true expose: - "80" #This is internal to container network environment: - NGINX_HOST=localhost - NGINX_PORT=80 command: [nginx-debug, "-g", "daemon off;"] – Elvin Jafarov Nov 16 '19 at 16:20
  • FROM nginx COPY ./ngnix.conf/ /etc/nginx/ngnix.conf – Elvin Jafarov Nov 16 '19 at 16:20