I am unable to deploy my react app under a sub directory on nginx running in docker container.
Below are the details
- React app basename setting BrowserRouter basename='/myreactapp'
- Package.json has "homepage": "/myreactapp"
nginx.conf
server { server_name localhost; index index.html; error_log /var/log/nginx/error.log; access_log /var/log/nginx/access.log; root /usr/share/nginx/html; location /myreactapp { try_files $uri $uri/ /myreactapp/index.html; } }Docker file
FROM nginx:1.14.1 COPY /build /usr/share/nginx/html COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]With this it still servers the app from '/' root location but not /myreactapp