vue 笔记
小于 1 分钟
nginx配置
vue打包
location / {
try_files $uri $uri/ /index.html;
}
location /admin {
proxy_pass http://xuekatu.cc;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
laravel
# location / {
# try_files $uri $uri/ /index.php?$query_string;
# }
location /index.php {
try_files /not_exists @octane;
}
location / {
try_files $uri $uri/ @octane;
}
location @octane {
set $suffix "";
if ($uri = /index.php) {
set $suffix ?$query_string;
}
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header Scheme $scheme;
proxy_set_header SERVER_PORT $server_port;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_pass http://127.0.0.1:10000$suffix;
}
thinkphp
location ~* (runtime|application)/{
return 403;
}
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}
dockerfile 打包
FROM nginx:1.21.5
# nginx 配置文件
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
# 复制文件
COPY ./dist /usr/share/nginx/html/
server {
listen 80;
server_name orangbus.test;
root "D:/laragon/www/vue/dist";
index index.html index.htm index.php;
# Access Restrictions
allow 127.0.0.1;
deny all;
location / {
try_files $uri $uri/ /index.html;
}
location /admin {
proxy_pass http://api.orangbus.test;
}
charset utf-8;
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
location ~ /\.ht {
deny all;
}
}
vue3初始化
yarn create vite my-vue-app --template vue
yarn add -D vuetify @mdi/font
// Vuetify
import 'vuetify/styles'
import { createVuetify } from 'vuetify'
import * as components from 'vuetify/components'
import * as directives from 'vuetify/directives'
const vuetify = createVuetify({
components,
directives,
})
createApp(App).use(vuetify).mount('#app')
