I would like to see /var/www/html/hoge/fuga/index.html
of the nginx file system when I get access at http://localhost:8080/fuga
.I would appreciate it if you could let me know if you know.
http://localhost:8080/fuga
does not know how to properly write location when accessed.
project
├-- docker-compose.yml
├-- Dockerfile
├-- nginx
│ --default.conf
└-- app
└-- html
├-- hoge
│ --fuga
│ ----index.html
└-- index.html
project/docker-compose.yml
version:"3"
services:
app:
build:
context:.
volumes:
- ./app: /var/www
ports:
- "8080:80"
project/Dockerfile
FROM nginx:1
WORKDIR/var/www/html
COPY./app/var/www/html
COPY./nginx/default.conf/etc/nginx/conf.d/default.conf
project/nginx/default.conf
server{
listen80;
listen [::]:80;
server_name localhost;
root/var/www/html/;
}
project/app/html/hoge/fuga/index.html
hogefuga
project/app/index.html
index
http://localhost:8080/fuga
you want to see hogefuga.
Added the following to default.conf:
server{
listen80;
listen [::]:80;
server_name localhost;
root/var/www/html/;
+ location/fuga{
+ root/var/www/html/hoge;
+ }
}
© 2024 OneMinuteCode. All rights reserved.