项目配置
前端使用vue.js,路由mode为history
,后端laravel请求统一为/api/*
nginx配置
wms.conf文件配置
server{
listen 80;
server_name testwms.com;
index index.html index.php;
error_log "E:/logs/nginx/wms/wms.error.log";
access_log "E:/logs/nginx/wms/wms.access.log";
set $fe_root_path "E:/project/wms_front/dist";
set $rd_root_path "E:/project/wms/public";
root $fe_root_path;
location ^~ /api {
try_files $uri $uri/ /index.php?$query_string;
}
location / {
try_files $uri $uri/ @router;
index index.html;
}
location @router {
rewrite ^.*$ /index.html last;
}
location ~ \.php {
root $rd_root_path;
try_files $uri =404;
fastcgi_index /index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root $fe_root_path;
}
location ~ /\.ht {
deny all;
}
}
复制代码