diff --git a/frontend-deploy/docker-compose.yml b/frontend-deploy/docker-compose.yml index 41be649..33d94ae 100644 --- a/frontend-deploy/docker-compose.yml +++ b/frontend-deploy/docker-compose.yml @@ -7,5 +7,5 @@ services: - "80:80" volumes: - ../dist:/usr/share/nginx/html:ro - - ../data:/usr/share/nginx/data:ro + - ../fiction:/usr/share/nginx/fiction:ro - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro \ No newline at end of file diff --git a/frontend-deploy/nginx.conf b/frontend-deploy/nginx.conf index 4c62f9d..2211ca0 100644 --- a/frontend-deploy/nginx.conf +++ b/frontend-deploy/nginx.conf @@ -9,8 +9,8 @@ server { location / { try_files $uri $uri/ /index.html; } - location /data/ { - alias /usr/share/nginx/data/; + location /novel-data/ { + alias /usr/share/nginx/fiction/; charset utf-8; } location /assets/ { diff --git a/frontend/vite.config.js b/frontend/vite.config.js index b9e4f71..143103c 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -15,7 +15,7 @@ export default defineConfig({ configureServer(server) { server.middlewares.use('/novel-data', (req, res, next) => { // req.url 会像 /dtslz/data/vol01.json - const filePath = path.resolve(__dirname, '..', req.url.replace(/^\//, '').split('?')[0]) + const filePath = path.resolve(__dirname, '../fiction', req.url.replace(/^\//, '').split('?')[0]) try { const content = fs.readFileSync(filePath, 'utf-8') res.setHeader('Content-Type', 'application/json; charset=utf-8')