web服务-------nginx
一、安装nginx软件
2. 安装源码编译是需要的函数库,和编译软件
pcre-devel:正则支持包
zlib-devel:解压支持的包
openssl-devel:支持加密
yum -y install gcc gcc-c++ make pcre-devel zlib-devel openssl-devel gcc gcc-c++ make
3. 创建运行的用户和组
useradd -M -s /sbin/nologin niginx
4. 下载解压安装包
#下载软件包 wget http://117.128.6.30/cache/nginx.org/download/nginx-1.17.8.tar.gz?ich_args2=472-07100221035132_0f58346c61a283013f43d4eca12fe8f3_10001002_9c896c2dd7c7f1d8913a518939a83798_2b87b5dc7b0daf3a6bbd3a36d82fab7d #解压软件包 tar xf nginx-1.17.8.tar.gz -C /usr/src/ cd /usr/src/nginx-1.17.8/
5. 编译安转nginx
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module&&make && make install --prefix 设定Nginx的安装目录 --user和--group 指定Nginx运行用户和组 --with-http_stub_status_module 启用http_stub_status_module模块以支持状态统计 --with-http_ssl_module 启用SSL模块 --with-http_flv_module 启用FLV模块,提供寻求内存使用基于时间的偏移量文件 --with-http_gzip_static_module 此模块的作用就是在接到请求后,会到url相同的路径的文件系统去找扩展名为“.gz”的文件
二、nginx的优化