Skip to content

Share Files Over Browser With Nginx

  • Nginx Config
Nginx Configuration File
server {

    # You can use diferent port - this is just an example
        listen 801;
        listen [::]:801;

#        server_name 10.0.50.70;

        root /var/www/html;

        location / {

              allow all;
                root /var/www/html;
                autoindex on;
        } 


}
  • docker-compose.yml - example (swarm)
YAML
version: "3.7"

services:

  nginx:
    image: nginx:alpine
  #  hostname: 
    networks:
      - durbok-net
    deploy:
      placement:
        constraints:
        - node.role == manager
      replicas: 1
      restart_policy:
        condition: on-failure
    ports:
      - 801:801
    volumes:
      - ./:/var/www/html # example
      - ./nginx-conf:/etc/nginx/conf.d
#      - ./ssl:/ssl
networks:
  durbok-net:
    external: true