Nginx的网站服务(手工编译安装过程细解)

  

Nginx网站服务

  

Nginx的概念

  

?Nginx引擎(x)是一个高性能的HTTP和反向代理web服务器,同时也提供了IMAP/POP3/SMTP服务.Nginx是由伊戈尔赛索耶夫为俄罗斯访问量第二的Ramblerru站点(俄文:Pamonep)开发的,第-一个公开版本0。1.0发布于2004年10月4日。
?其将源代码以类BSD许可证的形式发布,因它的稳定性,丰富的功能集,示例配置文件和低系统资源的消耗而闻名.2011年6月1日,nginx 1.0.4发布。
?Nginx是一款轻量级的Web服务器反向代理服务器及电子邮件(IMAP/POP3)代理服务器,在BSD-like协议下发行。其特点是占有内存少,并发能力强,事实上Nginx的并发能力在同类型的网页服务器中表现较好,中国大陆使用Nginx网站用户有:百度,京东,新浪,网,易腾讯,淘宝等。

  

Nginx手工编译安装

  

安装环境:Centos7 nginx-1.12.0.tar.gz

  

Nginx手工编译安装流程步骤细解如下:

  
 <代码类=" language-shell "> # Nginx设置
  nginx-1.12.0.tar.gz
  1 .解压缩软件包
  焦油zxf nginx-1.12.0焦油。广州- c/opt/2 .安装所需编译安装环境包
  yum安装gcc gcc-c + + pcre pcre-devel zlib-devel - y
  3 .创建家目录但不创建家目录
  useradd - m - s/sbin/nologin nginx
  4 .配置相关参数
  cd/opt/nginx-1.12.0
  ./configure \
  ——prefix=/usr/地方/nginx \
  ——用户=nginx \
  ——组=nginx \
  ——with-http_stub_status_module
  (统计模块)
  5 .编译安装
  使,,使安装
  6 .测试
  # cd/usr/local/nginx
  # ls
  # conf html日志sbin
  ln - s/usr/local/nginx/sbin/nginx/usr/local/sbin/# nginx - t
  nginx
  netstat natp | grep 80
  systemctl停止firewalld.service
  setenforce 0
  # yum安装- y elinks(测试网页工具)
  # elinks http://localhost
  
  7 . #基本管理
  nginx killall 3 (- s辞职)
  netstat -antp | grep 80
  killall 1 (- s HUP) nginx
  
  8。制作管理脚本 
  

Nginx手工编译安装实例

  
 <代码类=" language-shell "> [root@localhost ~] # yum安装gcc gcc-c + + pcre pcre-devel zlib-devel - y
  
  root@localhost ~ # cd LNMP-C7/[root@localhost LNMP-C7] # ls
  Discuz_X3.4_SC_UTF8。zip php-7.1.10.tar.bz2
  mysql-boost-5.7.20.tar。广州php-7.1.20.tar.bz2
  ncurses-5.6.tar。广州php-7.1.20.tar.gz
  nginx-1.12.2.tar。广州zend-loader-php5.6-linux-x86_64_update1.tar.gz
  php-5.6.11.tar.bz2
  [root@localhost LNMP-C7] #焦油zxf nginx-1.12.2.tar。广州- c/opt/[root@localhost nginx-1.12.2] # useradd - m - s/sbin/nologin nginx
  
  [root@localhost LNMP-C7] # cd/opt/root@localhost选择# cd nginx-1.12.2/# ./configure \ [root@localhost nginx-1.12.2)
  比;——prefix=/usr/地方/nginx \
  比;——用户=nginx \
  比;——组=nginx \
  比;——with-http_stub_status_module
  
  .....//省略部分内容
  nginx http代理临时文件:“proxy_temp”
  nginx http fastcgi临时文件:“fastcgi_temp”
  nginx http uwsgi临时文件:“uwsgi_temp”
  nginx http scgi临时文件:“scgi_temp”
  
  [root@localhost nginx-1.12.2] #做,,制作安装
  …//省略部分内容
  测试- d的/usr/地方/nginx/日志\
  | | mkdir - p/usr/地方/nginx/日志的
  [1]:离开目录/opt/nginx-1.12.2”
  [root@localhost nginx-1.12.2] # ln - s/usr/local/nginx/sbin/nginx/usr/local/sbin/[root@localhost nginx-1.12.2] # ln - s/usr/local/nginx/sbin/nginx/usr/local/sbin/[root@localhost nginx-1.12.2] # nginx - t/usr/local/nginx/conf/nginx. nginx:配置文件配置语法好/usr/local/nginx/conf/nginx. nginx:配置文件配置测试是成功的
  [root@localhost nginx-1.12.2] # nginx
  [root@localhost nginx-1.12.2] # netstat natp | grep nginx
  tcp 0 0 0.0.0.0:80 0.0.0.0: * 66585/nginx听:主人
  [root@localhost nginx-1.12.2] # systemctl firewalld.service停止
  [root@localhost nginx-1.12.2] # setenforce 0
  
  [root@localhost nginx-1.12.2] # yum安装- y elinks
  [root@localhost nginx-1.12.2] # elinks http://localhost//这里执行命令后显示对话框,好回车,输入问选择是的回车则退出到原本界面
   
  

以上就是对Nginx的手工编译安装的过程,下面我们介绍一下对Nginx的基本管理命令

  

Nginx的基本管理

  
 <代码类=" language-shell "> [root@localhost nginx-1.12.2] # killall 3 nginx//关闭nginx服务
  [root@localhost nginx-1.12.2] # netstat natp | grep nginx
  [root@localhost nginx-1.12.2] # nginx//启动nginx服务
  [root@localhost nginx-1.12.2] # killall 1 nginx//重启nginx服务
  [root@localhost nginx-1.12.2] # netstat natp | grep nginx
  tcp 0 0 0.0.0.0:80 0.0.0.0: * 76326/nginx听:主人//也可以使用以下命令进行关闭和重启
  killall - s nginx辞职
  killall - s玫瑰nginx
  [root@localhost nginx-1.12.2] # killall - s退出nginx
  [root@localhost nginx-1.12.2] # netstat natp | grep nginx
  [root@localhost nginx-1.12.2] # nginx
  [root@localhost nginx-1.12.2] # killall - s玫瑰nginx
  [root@localhost nginx-1.12.2] # netstat natp | grep nginx
  tcp 0 0 0.0.0.0:80 0.0.0.0: * 79214/nginx:听大师

Nginx的网站服务(手工编译安装过程细解)