Setup nginx conf for single-page routing

This commit is contained in:
Garrett Mills 2022-04-09 09:34:29 -05:00
parent ecdb474f7e
commit c28b8de128
5 changed files with 30 additions and 1 deletions

View File

@ -1,4 +1,5 @@
FROM nginx:latest FROM nginx:latest
COPY dist /usr/share/nginx/html COPY dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf

15
nginx.conf Normal file
View File

@ -0,0 +1,15 @@
worker_processes 4;
events { worker_connections 1024; }
http {
server {
listen 80;
root /usr/share/nginx/html;
include /etc/nginx/mime.types;
location / {
try_files $uri $uri/ /index.html;
}
}
}

View File

@ -11,7 +11,8 @@ import { MathPage } from './support/page'
<template> <template>
<div id="nav"> <div id="nav">
<router-link to="/">Home</router-link> <router-link to="/">Home</router-link> |
<router-link to="/scratch">Scratch Testing</router-link>
</div> </div>
<router-view/> <router-view/>
</template> </template>

View File

@ -0,0 +1,7 @@
<script setup lang="ts">
</script>
<template>
<p>Scratch page for testing!</p>
</template>

View File

@ -7,6 +7,11 @@ const routes = [
name: 'Home', name: 'Home',
component: Home, component: Home,
}, },
{
path: '/scratch',
name: 'Scratch',
component: () => import(/* webpackChunkName: "scratch" */ './components/Scratch.vue'),
},
] ]
const router = createRouter({ const router = createRouter({