1.brew的安装
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
2.rpm的安装
brew install rpm
3.终端访问服务器
/** 打开终端输入下列命令 */
sudo su -
输入密码后出现下图表现后执行下一步
ssh -p <端口号> <用户名>@<服务器公网ip>
出现下图红色框中所展示英文代表链接成功
4.nginx配置
/** 1.输入下列命令进入目录 */
$ cd /usr/local
/** 2.进入官网下载任意版本nginx */
$ wget http://nginx.org/download/nginx-1.9.12.tar.gz
/** 3.解压文件 */
$ tar -zxvf nginx-1.9.12.tar.gz
/** 使用命令查看文件列表,有nginx-1.9.12 目录则解压成功(可跳过) */
$ ls
/** 4.进入 nginx-1.9.12(若执行命令未发现文件使用ls查看列表无gz后缀文件继续执行第3步) */
$ cd nginx-1.9.12
/** 5.使用默认配置,若出现第6步错误,则执行第6步后,在重新执行第5步,未出现错误直接执行第7步*/
$ ./configure
/**
*6.报错信息
*./configure: error: the HTTP rewrite module requires the PCRE library.
*You can either disable the module by using --without-http_rewrite_module
*option, or install the PCRE library into the system, or build the PCRE library
*statically from the source with nginx by using --with-pcre=<path> option.
*执行下列命令
*/
$ yum install pcre-devel
/** 7.安装 */
$ make&&make install
/** 8.查看nginx安装目录 */
$ whereis nginx
/** 9.进入nginx目录 */
$ cd /usr/local/nginx/sbin/
/** 10.启动nginx */
$ ./nginx
nginx其他命令
/** 停止nginx */
$ ./nginx -s stop
/** 重启nginx */
$ ./nginx -s reload
/** 查看或编辑nginx配置 */
$ vim nginx.conf
/** 查看是否已安装nginx及安装位置 */
$ find -name nginx
/** 卸载nginx(若已有nginx且卸载失败可直接使用rm命令删除文件再重新安装) */
$ yum remove nginx
/** 删除文件 */
$ rm -rf <文件名+路径>
5.服务器防火墙操作
/** 查看防火墙是否处于开启状态(dead未开启,running已开启) */
$ systemctl status firewalld
/** 开启防火墙(无任何提示代表开启成功)再次输入上条命令查看防火墙是否已开启 */
$ systemctl start firewalld
/** 关闭防火墙 */
$ systemctl stop firewalld
/** 重启防火墙 */
$ firewall-cmd --reload
/**
*开放指定端口
*字段说明
*
作用域 –zone
*添加端口,格式为:端口/通讯协议
–add-port=80/tcp
*永久生效,没有此参数重启后失效 –permanent
*/
$ firewall-cmd --permanent --zone=public --add-port=12456/tcp
/** 查看开放端口列表 */
$ firewall-cmd --permanent --list-port
/** 关闭不需要的端口 */
$ firewall-cmd --zone=public--remove-port=80/tcp --permanent