How to deploy front-end and back-end separate projects to the server.

how the front-end and front-end separate projects are deployed to the server. The front end uses the vue, back-end to use the thinkphp, server. The LAMP. is built in the virtual machine

give me some advice.

Mar.02,2021

deployment is definitely separate, but some problems need to be solved after separation. For example, if you upload files in the backend, the URL path will inevitably be a little weird when the back.mysite.com/images/123456789.png, is displayed in the frontend, and the backend always wants to be exposed as little as possible for security reasons. There are several ways to solve these two problems, I personally prefer to use Nginx reverse proxy, the specific method is:
1. The foreground domain name www.mysite.com, does not match the domain name directly with the port number, such as 12.34.56.78 9999
2. Configure the www.mysite.com/api path reverse proxy in the front-end nginx configuration and point to 12.34.56.78:9999/api
3. Configure the www.mysite.com/images path reverse proxy in the front-end nginx configuration to point to 12.34.56.78:9999/images
so that the image URL is integrated, the backend is least exposed, and deployment and iteration are convenient.


each write its own script, which can be executed online when it is online, and the front end only calls the interface of the back end.

the front end is usually some compilation operation. Or put the compiled file online before going online.


just deploy separately. The request to the user is the front-end code, and then the front-end calls the back-end interface ~ or OK directly under the thinkphp

.
Menu