centos8安装nginx1.9.1的详细过程
时间:2022-08-22 09:23:00|栏目:Nginx|点击: 次
1.17.9 更香,真的
nginx下载地址:https://nginx.org/download/
1.下载nginx
2.解压nginx
tar -zxvf nginx-1.9.9.tar.gz
3.安装依赖包
yum -y install gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
4.配置nginx
cd nginx-1.9.9/ ./configure \--prefix=/usr/local/nginx \--with-http_ssl_module \--conf-path=/usr/local/nginx/conf/nginx.conf \--pid-path=/usr/local/nginx/conf/nginx.pid \--lock-path=/var/lock/nginx.lock \--error-log-path=/var/logs/nginx/error.log \--http-log-path=/var/logs/nginx/access.log \--with-http_gzip_static_module \--http-client-body-temp-path=/var/temp/nginx/client \--http-proxy-temp-path=/var/temp/nginx/proxy \--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \--http-scgi-temp-path=/var/temp/nginx/scgi
5.编辑部分配置,为下面执行make命令做准备
编辑文件 nginx 根目录:objs/Makefile
编辑文件:src/os/unix/ngx_user.c
6.编译
make
7.安装
make install
8.开放80端口
检查80端口是否开放:
firewall-cmd --zone=public --list-ports
如果没有 80/tcp 执行以下命令,开放端口
#永久开放80端口 firewall-cmd --zone=public --add-port=80/tcp --permanent #更新防火墙规则 firewall-cmd --reload
9.启动nginx
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
10.web访问