Answer the question
In order to leave comments, you need to log in
How to configure docker to work from under a domain on a local machine?
Good afternoon! I am developing an online store, I need to integrate payment, and for this you need to have a domain.
I have docker-compose with nginx and php-fpm:
version: '3'
services:
shop-nginx:
build:
context: ./docker
dockerfile: nginx.docker
volumes:
- .:/app
depends_on:
- shop-php-fpm
ports:
- "8083:80"
shop-php-fpm:
build:
context: ./docker
dockerfile: php-fpm.docker
volumes:
- .:/app
- ./docker/php-fpm/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
tty: true
server {
listen 80;
index index.php index.html;
root /app/public;
client_max_body_size 50m;
location / {
try_files $uri /index.php?$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass shop-php-fpm:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
Answer the question
In order to leave comments, you need to log in
Add to /etc/hosts:
127.0.0.1 yourdomain.local
In docker port 80 outside if you want to open yourdomain.local
ports:
- "80:80"
server_name is not necessary if you have one host.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question