nginx学习记录

nginx的安装:Centos7安装nginx
yum install gcc-c++
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
wget -c https://nginx.org/download/nginx-1.10.1.tar.gz
tar -zxvf nginx-1.10.1.tar.gz
cd nginx-1.10.1
./configure
make
make install
cd /usr/local/nginx/sbin
./nginx 启动nginx
./nginx -s stop或者 ./nginx -s quit 关闭nginx
./nginx -s reload 重启nginx
Linux查看端口:
netstat -ntpl
查看nginx是否运行:

  1. ps -ef | grep nginx
  2. ps -C nginx -o pid
  3. netstat -anp | grep :80
  4. lsof -i:80
    nginx启动报错80端口被占用,解决方法:
    https://product.pconline.com.cn/itbk/software/dnyw/1707/9625722.html
    /var/run/yum.pid 已被锁定,PID 为 XXXX 的另一个程序正在运行,解决办法:
    直接在终端运行 rm -f /var/run/yum.pid 将该文件删除,然后再次运行yum
    登陆服务器之后进到nginx使用./nginx -s reload重新读取配置文件,发现报nginx: [error] open() “/usr/local/nginx/logs/nginx.pid” failed (2: No such file or directory)错误,进到logs文件发现的确没有nginx.pid文件
    解决方法:
    [root@localhost nginx]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
    使用nginx -c的参数指定nginx.conf文件的位置
    [root@localhost nginx]# cd logs/
    [root@localhost logs]# ll
    nginx.pid文件便会有了。
    nginx的alias的使用:
    https://blog.csdn.net/tuoni123/article/details/79712246
    查找相关文件find / -name nginx
    rm -rf /etc/nginx
    yum remove nginx
    https://www.jianshu.com/p/e7034b344bed
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值