系统软件使用及常见报错

来源:互联网 发布:c语言发牌程序 编辑:程序博客网 时间:2024/05/18 08:24
nginx常用操作
反向代理 以二打一赛事奖金为例
以下示例为将80端口转发到19182端口


7行 nginx监听端口80
9行 接收到的域名
14行 proxy_pass模块 指向后端

1,2 接受转发 到本地的19182端口

访问ccpc-withdraw-web.imsa..cn即可 (可能需配置hosts)
此配置位于172.21.120.207 /etc/nginx/conf.d/ccpc.conf

参考资料:http://www.nginx.cn/76.html
http://www.cnblogs.com/anruy/p/4989161.html
此处涉及配置hosts或dns , 反向代理亦是负载均衡一种
拓展阅读:
dns介绍:http://www.ruanyifeng.com/blog/2016/06/dns.html
负载均衡介绍: http://help.chinac.com/article/index/fid/208.html



iptables防火墙常用配置:
防火墙要配置在被访问端
以172.21.120.185为例:
sudo vi /etc/sysconfig/iptables 文件 在上面添加一行
-A INPUT -s 172.21.120.209/32 -p tcp -m tcp --dport 18201 -j ACCEPT
接收209访问本机的18201端口
此处如为172.21.120.0/24即为接收整个120段 斜杠后面为子网掩码
注意: 防火墙为顺序执行 加到末尾无法执行 和其余-A INPUT配置放到一起 加到靠前的位置即可

此处涉及子网掩码计算自行百度,推荐掩码计算器http://www.jisuanqinet.com/kexue/ip.html
iptables拓展阅读:http://www.jianshu.com/p/586da7c8fd42


系统无法登陆:
最常见问题是dev用户资源不足 更改以下文件配置系统资源限制即可
? dev@ZQWY-TEST-120185 ~ sudo cat /etc/security/limits.d/90-nproc.conf
# Default limit for number of user's processes to prevent
# # # accidental fork bombs.
# # # See rhbz #432903 for reasoning.
# #
# # #* soft nproc 1024
# # #* soft nproc 131702
# # root soft nproc unlimited
# #
* hard nofile 131702
* soft nofile 131702
* soft nproc 131702
* hard nproc 131702
* soft core unlimited
* hard core unlimited
* soft memlock unlimited
* hard memlock unlimited
#



文件挂载
mount


共享服务器挂了之后重启rpcbind和nfs

sudo service rpcbind restart
sudo service nfs restart


然后重新挂载即可
sudo + 挂载命令执行
命令放在/etc/rc.local文件末尾 
查看此文件  sudo  cat /etc/rc.local


检查共享服务器是否正常  showmount -e 172.21.120.210   有正常输出结果即可

示例:
将229的/data/share/static挂载到本地的/home/dev/share/static
sudo mount -t nfs 172.21.120.229:/data/share/static /home/dev/share/static -o nolock -o proto=tcp
本地的目录提前建立



原创粉丝点击