阿里云部署nodejs
购买阿里云服务器
1 | 启动 |
1 | 退出 |
安装nodejs
1 | 安装环境之前先更新一下已有的包 |
1 | 使用yum安装指定版本node |
安装MySQL
1 | 安装 |
1 | 修改mysql密码并配置远程连接 |
1 | 解决mysql“Access denied for user 'root'@'IP地址' |
1 | 添加安全组规则 |
安装nginx
1 | yum install nginx |
1 | 解决nginx 启动问题 |
1 | 添加安全组 |
部署nodejs项目
1 | 下载git |
1 | 根目录建立service文件夹 |
1 | 安全组配置 |
安装redis
1 | 1. 设置Redis的仓库地址 |
部署react 项目
1 | 1. 建立website 文件 |
touch demo_client.conf
vim /etc/nginx/conf.d/demo_client.conf
server {
listen 8080;
root /root/website/demo-client/build;
index index.html index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
:wq1
2
3
4
解决nginx 500 是因为用户权限不一致
vim /etc/nginx/nginx.conf
use nginx 改成 use root