Answer the question
In order to leave comments, you need to log in
How to set up a simple site with nginx using docker-compose?
Site structure
docker:
conf:
myapp.loc
public:
index.html
docker-compose.yml
server {
listen 80;
server_name myapp.loc;
index index.php index.html;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /app/public;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}
version: "2"
services:
web:
image: nginx:1.15
ports:
- "9090:80"
volumes:
- ./docker/conf/myapp.loc:/etc/nginx/sites-enabled/myapp.loc
- .:/app
<h4>HELLO, WORLD</h4>
Answer the question
In order to leave comments, you need to log in
listen 80 default_server;
Or set up your working machine so that the site is opened by myapp.loc:9090 - you specify thatserver_name myapp.loc;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question