Nginx服务器环境搭建

1.下载Nginxd安装包

   Nginx官网查看Nignx版本,找到stable版本下载

    wget -c https://nginx.org/download/nginx-1.16.0.tar.gz

   解压安装包:tar -zxvf nginx-1.16.0.tar.gz

2.配置Nginx

  root用户执行

  >yum install gcc-c++ -y

  >yum install zlib zlib-devel -y

  >yum install pcre pcre-devel -y 

  >yum install openssl openssl-devel -y

  >./configure

  >make install

  >whereis nginx

3.Nginx启停

  >cd /usr/local/nginx/sbin

  --启动

  >./nginx

  --查出Nginx进程id,然后使用kill命令强制杀掉进程

  >./nginx -s stop 

  --待Nginx进程处理完任务再进行停止

  >./nginx -s quit

  --重新加载配置文件使其生效

  >./nginx -s reload

  查看nginx进程

  >ps -ef | grep nginx

  [root@pgdb_slave sbin]# ps -ef | grep nginx
  root 61636 1 0 23:01 ? 00:00:00 nginx: master process ./nginx
  nobody 61637 61636 0 23:01 ? 00:00:00 nginx: worker process
  root 61641 53355 0 23:06 pts/0 00:00:00 grep --color=auto nginx

 

3.修改Nginx端口号

  >cd /usr/local/nginx/conf

  >cp nginx.conf nginx.confbak

  >vim nginx.conf

  修改server项内的端口号

  >./nginx -s reload

  --重启

  >./nginx -s quit

  >./nginx

4.配置开机启动

  >echo "/usr/local/nginx/sbin" >> /etc/rc.local

5.登录页面

  ip:port

    

 

 

 

 

 

  

转载于:https://www.cnblogs.com/slqdba/p/10823901.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值