nginx服务器上部署react项目

hh的nginx文件路径是“/usr/local/nginx”

进入nginx文件:cd /usr/local/nginx
获取管理员权限:sudo su .
修改配置文件: vi nginx.conf
进入编辑模式:i
上翻或下翻:使用键盘的上下箭头
退出编辑模式:ESC

最后退出nginx.conf
保存并退出是':wq'
直接退出是‘:q’
不保存退出是:':q!'

查看现在nginx的配置文件位置:nginx -t
重启或刷新nginx:nginx -s reload

然后就可以配置代理访问了

停止nginx服务的命令:nginx -s stop

两个配置nginx的地方 
一个在‘/etc/nginx/conf.d’的conf目录下
一个在‘/usr/local/nginx’的nginx.conf目录下
nginx -h 命令可以查看启动nginx相关信息
启动默认nginx配置文件:nginx (或者(nginx -c /etc/nginx/nginx.conf))
启动指定nginx配置文件:nginx -c nginx配置文件路径
(nginx -c /usr/local/nginx/nginx.conf)

如果配置好了,访问到其他项目的话,就kill进程,重启nginx。
原文地址:https://www.cnblogs.com/afafaa/p/14443071.html