前后端分离开发完毕打包后,面临上线部署问题,一种做法是前后端分开来部署。前端nginx服务器配置反向代理;另外一种做法是把打包好的前端代码放置ThinkPHP框架Public目录下,默认访问index.html即可
location /admin/ {proxy_set_header Host $proxy_host;proxy_set_headerX-Real-IP$remote_addr;proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;proxy_set_header X-NginX-Proxy true;proxy_pass 'http://admin.caorulai.com/';}