1.安装依赖包
sudo yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
2.下载并解压安装包
cd /usr/local//下载tar包 sudo wget http://nginx.org/download/nginx-1.18.0.tar.gz sudo tar -xvf nginx-1.18.0.tar.gz
3.安装nginx
//进入nginx目录 cd /usr/local/nginx-1.18.0
4.编译 make&make install
//执行命令 sudo ./configure sudo make sudo make install
三、配置
sudo vi /usr/local/nginx/conf/nginx.conf
server { listen 81; server_name 172.18.96.200; #服务端地址 location / { root html; index index.html index.htm; } }
四、启动
# 检查配置文件 sudo /usr/local/nginx/sbin/nginx -t #启动 sudo /usr/local/nginx/sbin/nginx # 重启加载配置 sudo /usr/local/nginx/sbin/nginx -s reload
五、验证
访问 172.18.96.200:81
代表nginx安装成功!
标签:tar,local,make,sudo,nginx1.18,nginx,usr,linux,安装 From: https://www.cnblogs.com/wujunjie010203/p/17176619.html