How to assign the domain name to the port in Docker

  docker, laravel

I mounted Laravel on port 80 in Docker and this is my service in docker-compose.yml

  webserver:
    image: nginx:alpine
    container_name: webserver
    restart: unless-stopped
    tty: true
    ports:
    - "8000:80"
    - "8443:443"
    volumes:
    - ./:/var/www/docker/example/api
    - ./nginx/conf.d/:/etc/nginx/conf.d/

I want to mapping 8000 port from ubuntu with 80 on docker that you see is done.
and the site comes up with this address http://ip_server:8000

I want to come up with the domain name of the site without entering the port

server {
    listen 80;
    index index.php index.html;
    server_name example.com;
    error_log  /var/log/nginx/error.log;
    access_log /var/log/nginx/access.log;
    root /var/www/docker/khesarat/api/public;

    location ~ .php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+.php)(/.+)$;
        fastcgi_pass app:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }
}

Source: Docker Questions

LEAVE A COMMENT