nginx官网下载链接:http://nginx.org/en/download.html
下载稳定版即可
这里由于上传工具很多,不予展示
whereis nginx
rm -rf [nginx文件]
yum -y install gcc zlib zlib-devel pcre-devel openssl* openssl-devel ncurses-devel
tar -zxvf nginx-1.24.0.tar.gz
# 在 /opt/nginx/nginx-1.24.0 下执行命令
cd /opt/nginx/nginx-1.24.0
./configure #先执行
# 再执行
# 执行完 make && make install 之后 nginx 会被安装在 /usr/local/ 下(没有指定安装目录会默认安装在 /usr/local/ 下)
make && make install PREFIX=/usr/local/nginx
cd /usr/local/nginx
cd ./sbin #进入sbin文件
./nginx #启动nginx程序
在Windows上访问Linux下的nginx来确认是否安装成功:
http://192.168.25.201:80
./nginx -s stop #停止nginx
./nginx -s quit #安全退出
./nginx -s reload #修改了文件之后重新加载该程序文件
ps -aux | grep nginx #查看nginx进程
# 进入 nginx 的 conf 目录下
cd /usr/local/nginx/conf
# 修改 nginx.conf 文件
vim nginx.conf
# 修改完配置文件一定要重新加载该程序文件
./nginx -s reload