Fix production deploy under /admin/ with correct Vite base path and server config.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
# Example: admin panel at https://parche.montech.ir/admin/
|
||||
# Place dist/ contents in the server path mapped to /admin/
|
||||
|
||||
location /admin/ {
|
||||
alias /var/www/parche/admin/;
|
||||
try_files $uri $uri/ /admin/index.html;
|
||||
}
|
||||
|
||||
location ~ ^/admin/assets/ {
|
||||
alias /var/www/parche/admin/assets/;
|
||||
expires 7d;
|
||||
add_header Cache-Control "public, immutable";
|
||||
types {
|
||||
application/javascript js;
|
||||
text/css css;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
<html lang="fa" dir="rtl">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="icon" href="/favicon.ico">
|
||||
<link rel="icon" href="%BASE_URL%favicon.ico">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>پنل مدیریت | پَر فام بافت</title>
|
||||
</head>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteBase /admin/
|
||||
|
||||
# Serve existing files and directories
|
||||
RewriteCond %{REQUEST_FILENAME} -f [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -d
|
||||
RewriteRule ^ - [L]
|
||||
|
||||
# SPA fallback
|
||||
RewriteRule ^ index.html [L]
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_mime.c>
|
||||
AddType application/javascript .js
|
||||
AddType text/css .css
|
||||
AddType application/wasm .wasm
|
||||
</IfModule>
|
||||
+4
-3
@@ -6,15 +6,16 @@ import vueJsx from '@vitejs/plugin-vue-jsx'
|
||||
import vueDevTools from 'vite-plugin-vue-devtools'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
export default defineConfig(({ mode }) => ({
|
||||
base: '/admin/',
|
||||
plugins: [
|
||||
vue(),
|
||||
vueJsx(),
|
||||
vueDevTools(),
|
||||
...(mode === 'development' ? [vueDevTools()] : []),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
},
|
||||
},
|
||||
})
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user