tar pre include eas files 安装 nginx react oot
查看 CentOS 版本:
- cat / etc / redhat - release
安装 nginx:
- yum install nginx
查看 nginx 版本:
- nginx - v
启动 nginx:
- systemctl start nginx
nginx 默认发布目录:
- cd / usr / share / nginx /
由于是单页应用虚拟路由的原因,需要将 nginx 的所有请求都转发到 index.html 页面,所以需要修改配置文件:
- server {
- listen 80 default_server;
- listen[: :] : 80 default_server;
- server_name _;
- root / usr / share / nginx / html;
- #Load configuration files
- for the
- default server block.include / etc / nginx /
- default.d
- /*.conf;
- location ~* html {
- rewrite .* /index.html break;
- root /usr/share/nginx/html/;
- }
- error_page 404 /404.html;
- location = /index.html {
- }
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- }
- }*/
CentOS 下 Nginx 部署 React 静态应用
来源: http://www.bubuko.com/infodetail-2218371.html