123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- linux指令:
- wget 安装
- rm -r/-rf 删除文件/文件夹下所有内容
- vi ... 打开文件,进入编辑器模式
- 编辑器模式: i => 开始插入 ; esc 停止插入 ; : x/wq 保存并退出
- mv a b 移动文件a 至 b
- tar -zxvf 解压
- touch 新建文件
- mkdir 创建文件夹
- pwd 当前路径
- du -sh 统计当前文件夹的占用 h:以人类能读的方式显示
- crontab -l 查看定时任务
- mongodb 启动 ./mongod --config ./mongodb.conf
- 查看目录下的文件夹占用磁盘资源: du -sh * | sort -n
- 重启后,首先关闭防火墙:
- systemctl stop firewalld.service
- systemctl start nginx.service
- systemctl start mongodb.service
- mongodb:
- [root@localhost bin]# ./mongod -f /usr/local/mongodb/mongodb.conf
- mongodb的配置文件使用绝对地址
- 创建用户:
- 进入mongodb的shell
- use admin
- db.createUser({user:"admin",pwd:"111111",roles:[{role:"root",db:"admin"}]})
- 登陆:
- db.auth("admin","111111")
- 如果不能直接使用mongo,说明没有配置环境变量
- 进入 /etc,查看profile
- sudo vi/vim /etc/profile
- 添加:export PATH=/usr/local/mongodb/bin:$PATH
- 保存=>执行
- source /etc/profile
- 创建systemctl指令:
- 进入/etc/systemd/system
- 创建mongodb.service
- 写入:
- [Unit]
- Description=mongodb
- After=network.target
- [Service]
- # 注意这个地方是个坑,如果你的mongodb配置文件中设置的作为守护线程运行,下面这一>行一定要加上
- Type=forking
- ExecStart=/usr/local/mongodb/bin/mongod -f /usr/local/mongodb/bin/mongodb.conf
- [Install]
- WantedBy=multi-user.target
- 保存即可使用
- nodejs:
- 官网复制地址=>wget/curl下载=>tar解压=>改名
- 软连接,全局使用:
- ln -s /usr/local/nodejs/bin/node /usr/bin/node
- ln -s /usr/local/nodejs/bin/npm /usr/bin/npm
- 配置nodejs缓存和本地库:
- 在nodejs根目录下:
- mkdir node_global && mkdir node_cache
- 修改node设置:
- npm config set prefix "node_global" && npm config set cache "node_cache"
- 配置nginx:
- 前端:
- location ^~/${prefix} {
- root ${position};
- index index.html index.htm;
- try_files $uri $uri/ /${prefix}/index.html;
- }
- 服务端:
- location ^~ ${apiPrefix} {
- proxy_pass http://127.0.0.1:${port};
- }
- 静态目录:
- location /${prefix}/ {
- root ${position};
- rewrite ^/${prefix}/(.*)$ /$1 break;
- try_files $uri @fs;
- }
- @fs:为上传服务端配置
- mq:
- location /ws {
- proxy_pass http://127.0.0.1:15674;
- proxy_set_header host $host:$server_port;
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "upgrade";
- }
- rpm等包管理器安装,tar解压则需要自己配置:
- vi /etc/nginx/nginx.conf 打开nginx配置文件
- 启动:systemctl start nginx.service
- 停止:systemctl stop nginx.service
- 重启:systemctl restart nginx.service
- 证书:
- .crt,.key放到哪里都行,反正在nginx.conf中配置好就行
- 放开https部分,没有自己扒一个
- 关键点:
- server_name:域名,不加前缀,直接写域名
- ssl on;
- ssl_certificate: 证书位置,就是上面的.crt的路径(用绝对的.只要不写错,准没问题)
- ssl_certificate_key: 私钥,同上
- 然后配置使用https的服务端,前端啥的
- 文件上传:
- 由服务端发起,指令:
- rz:上传,选择文件,然后到指定目录再执行 rz,就存在当前位置了
- sz:下载
- sftp方式:
- ls,cd:远程服务器
- lls,lcd:本机
- put xxx 上传文件
- get xxx 下载服务器 ls的位置
- 所有访问都是502:
- getsebool httpd_can_network_connect 允许外部访问 如果是off,用下面改成on
- setsebool -P httpd_can_network_connect on
- ubuntu:
- 用户名:lrf
- 密码:1qaz2wsx
- linux:
- 用户名:root
- 密码:1327542758
|