服务器崩溃,从0开始安装minio——③安装nginx
1.创建nginx目录并进入到nginx目录下
mkdir nginx && cd nginx
2.联网状态下下载Nginx安装包(也可以将网址复制到浏览器下载)
wget http://nginx.org/download/nginx-1.18.0.tar.gz
3.解压Nginx压缩包
tar zxvf nginx-1.18.0.tar.gz
4.进入Nginx目录下
cd /nginx/nginx-1.18.0
5.配置安装运行目录
./configure --prefix=/usr/local/nginx
6.出现如下错误需要安装依赖包(需要有网络下运行并还是超级管理员)
yum -y install pcre-devel yum -y install openssl openssl-devel 或直接 yum -y install gcc openssl-devel pcre-devel zlib-devel
重启网卡
systemctl restart network
7.进行重新配置
不安装全的话,ssl不能用;
./configure --prefix=/usr/local/nginx --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --error-log-path=/usr/local/nginx/log/error.log --http-log-path=/usr/local/nginx/log/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 --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module
或者后来再安装覆盖:
https://blog.csdn.net/qq_27328865/article/details/103118364
8.执行编译安装
make && make install
9.安装完毕,进入Nginx下的sbin目录并启动nginx
cd /usr/local/nginx/sbin
./nginx
10.这时如果启动不成功可能是防火墙问题导致,就需要关闭防火墙
systemctl stop firewalld.service
11.访问Nginx,IP地址为自己虚拟机的
http://ip/
12.如果需要修改配置文件 ,修改之后要重新加载配置文件
nginx -s reload
13.Nginx命令配置到系统环境
vim /etc/profile
在最后一行添加
export PATH=$PATH:/usr/local/nginx/sbin
保存后运行,使之生效
source /etc/profile
14.设置开机启动
待补充
几个命令
#进入命令管理文件夹sbin
cd /usr/local/nginx/sbin
#启动nginx
./nginx或./nginx -c /usr/local/nginx/conf/nginx.conf#彻底干掉nginxpkill nginx
#停止nginx(同kill,比较粗暴)
./nginx -s stop
#停止nginx(等待进程处理完毕进行关闭)
./nginx -s quit
#重启nginx ./nginx -s reload

浙公网安备 33010602011771号