部署(React)

2019-08-12  本文已影响0人  斯特莫

初始化

npx create-react-app my-app
cd my-app
npm start

页面开发

过程省略

build

npm run build

这时会生成一个build文件夹


build文件夹

其中index.html是入口文件, static里面是打包的css和js文件

部署

在nginx.conf里面配置location,html是nginx里面的文件夹。


nginx配置

重新启动nginx

./sbin/nginx -s stop
./sbin/nginx

这时候打开页面就是开发好的页面了

上一篇下一篇

猜你喜欢

热点阅读