老哥,我看你问题标签里包含了laravel,那么后端应该 laravel。首先,若前端代码都完成,可以打包放置在laravel项目 /public 目录下。前端路由需要 nginx 的配置,比如: location / { root /var/www/xxxx/public/dist; index index.html index.htm; try_files $uri $uri/ /index.html; } 因为你的项目是前后端分离,因而后端api路由,可以反向代理一下: server { listen 80; .... location /api { proxy_set_header Host $http_host; proxy_pass http://backend; } } ...... upstream backend { server 127.0.0.1:8080; } server { listen 8080; server_name localhost; root /var/www/xxxx/public; index index.php; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { try_files $uri /index.php=404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php7.1-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
老哥,我看你问题标签里包含了
laravel
,那么后端应该laravel
。首先,若前端代码都完成,可以打包放置在laravel项目
/public
目录下。前端路由需要
nginx
的配置,比如:因为你的项目是前后端分离,因而后端api路由,可以反向代理一下: