第一篇 Nginx使用介绍

一. 简单使用 介绍

https://www.cnblogs.com/lovershowtime/p/11711308.html

1. nginx介绍

Nginx("engine x")是一款是由俄罗斯的程序设计师Igor Sysoev所开发高性能的 Web和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器。

在高连接并发的情况下,Nginx是Apache服务器不错的替代品。

 2. 安装

依赖包:
     yum -y  install gcc  gcc-c++  autoconf  automake                             
                yum -y install  zlib zlib-devel  openssl  openssl-devel  pcre pcre-devel  
                yum -y install gcc automake autoconf libtool make



安装流程

1 .wget http://nginx.org/download/nginx-1.16.1.tar.gz  下载

2.  tar zxvf nginx-1.16.1.tar.gz    解压
     
  

3.    cd nginx-1.16.1  进入解压好的nginx 下
        [root@localhost src]# cd nginx-1.16.1


         4.  ./configure --prefix=/usr/local/nginx    安装路径
              [root@localhost nginx-1.16.1]# ./configure --prefix=/usr/local/nginx

         5.  make && make install      安装编译
             [root@localhost nginx-1.16.1]# make && make install


6. cd nginx/   进入到nginx安装目录下
    [root@localhost local]# cd nginx/

    [root@localhost nginx]# ls
    conf   配置文件
    html  网页文件
    logs  日志文件
    sbin 主要进程文件(二进制文件)

7.     ./sbin/nginx    启动
        [root@localhost nginx]# ./sbin/nginx(报的错误表示80端口被站  有时候 其他服务站了或者 系统服务站了)
       nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
       nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
       nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
       nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
      nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
      nginx: [emerg] still could not bind()

8.  netstat -ant  或 netstat -antp  查看端口命令  端口详情

9. kill -9 进程号       杀掉进程

10. 防火墙

    查看防火状态
    systemctl status firewalld
    service  iptables status

    暂时关闭防火墙
   systemctl stop firewalld
   service  iptables stop

    永久关闭防火墙
    systemctl disable firewalld
    chkconfig iptables off

11. ps -ef | grep nginx      ps命令将某个进程显示出来

   root 4991 1 0 08:18 ? 00:00:00 nginx: master process ./sbin/nginx
   nobody 4992 4991 0 08:18 ? 00:00:00 nginx: worker process
   root 5166 2176 0 08:40 pts/0 00:00:00 grep nginx




原文地址:https://www.cnblogs.com/lovershowtime/p/11828027.html