Apache与nginx的对比

Apache:select模型(类似于同步)高并发的时候占用资源较多。

Nginx:epoll模型()类似于异步),对小文件并发有很大优势,大文件并发上一般,高并发的时候占用资源不高。支持web、反向proxy(反向代理),cache(缓存)三大功能并且都很优秀。  

 

一.安装相关依赖包

安装编译工具

yum -y install gcc gcc-c++  

安装pcre

yum -y install pcre pcre-devel  

安装openssl

yum -y install openssl*  

 

二.安装nginx

解压安装包

tar -xf nginx-1.14.0.tar.gz

cd nginx-1.14.0  

编译参数

./configure --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module --prefix=/usr/local/nginx  

安装

make && make install  

 

三.环境配置 开放防火墙

firewall-cmd --add-port=80/tcp --permanent

firewall-cmd --reload  

 

四.启动nginx

/usr/local/nginx/sbin/nginx  

 

 

/usr/local/nginx/sbin/nginx -s reload 重新读取配置文件

/usr/local/nginx/sbin/nginx -s stop 关闭nginx

相关文章:

  • 2021-07-31
  • 2021-07-16
  • 2021-07-30
  • 2021-08-07
  • 2022-01-07
  • 2022-12-23
  • 2022-12-23
  • 2021-05-03
猜你喜欢
  • 2021-05-29
  • 2021-12-04
  • 2022-12-23
  • 2022-02-03
  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案