简体   繁体   English

我想知道一些关于如何托管和上传完整网站的事情,包括(服务器、反应、mysql)

[英]i would like to know few things about how to host and upload full website include(server ,react, mysql)

Finally i completed my first full project using server, client, data最后,我使用服务器、客户端、数据完成了我的第一个完整项目

i would like to know few things about how to host and upload full website include(server,react, mysql)我想知道一些关于如何托管和上传完整网站的事情,包括(服务器、反应、mysql)

i so wondering how that is work, for now i understand that to upload a simple website you need a domain and to hosting, just do npm run build and upload it..., this is something that i know but, when that is not just a simple website like我很想知道这是如何工作的,现在我知道要上传一个简单的网站,您需要一个域并进行托管,只需执行npm run build并上传它...,这是我知道的,但是,当那不是只是一个简单的网站

when i have such as当我有这样的

  1. server side with Node.js + express that have requests (on localhost) *probably need to change the localhost to something else but what带有 Node.js + express 的服务器端有请求(在本地主机上) *可能需要将本地主机更改为其他内容,但是什么
  2. Database running with MySql使用 MySql 运行的数据库
  3. React app that have many request to (localhost)反应对(localhost)有很多请求的应用程序

how can i hosting all of them and running my website for everyone, i mean that my sql will still running, CRUD Data will update normal, and the server will still get request and send or update them to mysql data.我如何托管所有这些并为每个人运行我的网站,我的意思是我的 sql 仍将运行,CRUD 数据将正常更新,服务器仍将收到请求并将其发送或更新为 mysql 数据。

and if I'll want to make some change on mysql, server, client i want to change it like i change it now如果我想对 mysql、服务器、客户端进行一些更改,我想更改它,就像我现在更改它一样

Actually i'm not a FullStack developer if i don't know it... so i really interesting to understand all of that issues实际上,如果我不知道的话,我不是 FullStack 开发人员......所以我真的很有趣了解所有这些问题

i hope you guys havק An understandable answer for me, thanks and just take your time:)我希望你们有一个对我来说可以理解的答案,谢谢,慢慢来:)

Well, where to start hehe.好吧,从哪里开始嘿嘿。 There are a lot of different ways to host a web app.托管 web 应用程序有很多不同的方法。 Heroku for example makes this process really simple.例如Heroku使这个过程非常简单。

Personally, I use Digital Ocean to host my apps.就个人而言,我使用Digital Ocean来托管我的应用程序。 This is generally how that goes:一般是这样的:

I have a project with a folder structure that seperates the server logic and the client logic.我有一个项目,其文件夹结构将服务器逻辑和客户端逻辑分开。

Since you're using Node, you build your client with npm run build .由于您使用的是 Node,因此您可以使用npm run build构建您的客户端。 Next make sure the dist/build folder is inside your server folder.接下来确保 dist/build 文件夹在您的server文件夹中。 That is the folder you are going to 'host'.那就是您要“托管”的文件夹。 On Digital Ocean, you make a new droplet (which basically is just a tiny part of a server).在 Digital Ocean 上,你制作了一个新的 droplet(它基本上只是服务器的一小部分)。

You install Node , Git , Pm2 and (for example) Nginx .您安装NodeGitPm2和(例如) Nginx You clone your project from Github to the server and install all the dependencies.您将项目从 Github 克隆到服务器并安装所有依赖项。

You have to do a few configurations with nginx (specifying a domain name for example) to make everything work.您必须对 nginx 进行一些配置(例如指定域名)才能使一切正常。 This article goes into more detail about that. 本文对此进行了更详细的介绍。

Also, a database is frequently hosted seperately.此外,数据库经常单独托管。 You should read more about that.您应该阅读更多相关信息。

If you have everything setup, you can just code on your project as usual.如果您已完成所有设置,则可以像往常一样在项目上编写代码。 Push new updates to github, and pull in the changes on the server.将新更新推送到 github,并拉入服务器上的更改。

Here is another post on Stackoverflow talking about hosting MySql with react.这是 Stackoverflow 上的另一篇文章,讨论使用 react 托管 MySql。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM