发布网友 发布时间:2022-03-23 02:05
共2个回答
懂视网 时间:2022-03-23 06:26
产品型号:Thinkpad E15
系统版本:centos8
通过yum安装nginx服务
[root@xuegod63 ~]# yum install -y epel-release #安装epel源
[root@xuegod63 ~]# yum install -y nginx #安装nginx
[root@xuegod63 ~]# systemctl start nginx #启动nginx
[root@xuegod63 ~]# iptables -F #清空防火墙
打开浏览器,访问虚拟机的IP地址:http://192.168.1.63/
可以访问,成功,说明nginx安装成功了。
总结:
1. yum install -y epel-release
2. yum install -y nginx
3. systemctl restart nginx
热心网友 时间:2022-03-23 03:34
(0) 安装依赖包
yum -y install pcre*
yum install autoconf automake zlib zlib-devel openssl openssl-devel pcre pcre-devel gcc
yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel
yum -y install pcre-devel
yum -y install openssl openssl-devel
yum -y install lrzsz
yum -y install gcc gcc-c++
yum -y install openssl*
(1) 编译安装 PCRE
wgetftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-7.7.tar.gz
tar zxvf pcre-7.7.tar.gz
cd pcre-7.7
./configure
make
make install
下载 pcre-8.31.tar.gz
[root@localhost /]# cd /media/psf/Home/Downloads
[root@localhost Downloads]# mv pcre-8.31.tar.gz /home/Nginx
[root@localhost Downloads]# cd /home/Nginx
[root@localhost Nginx]# tar -zxvf pcre-8.31.tar.gz
[root@localhost Nginx]# cd pcre-8.31
[root@localhost pcre-8.31]#
[root@localhost pcre-8.31]# make
[root@localhost pcre-8.31]# make install
(2) 编译安装 nginx-sticky-mole-1.1
[root@localhost Downloads]# cd /home/Nginx
[root@localhost Nginx]# mkdir nginx-sticky-mole-1.1
[root@localhost Nginx]# cd /media/psf/Home/Downloads
[root@localhost Downloads]#
mv nginx-sticky-mole-1.1.tar.gz /home/Nginx/nginx-sticky-mole-1.1/
[root@localhost Downloads]# cd /home/Nginx/nginx-sticky-mole-1.1/
[root@localhost nginx-sticky-mole-1.1]# tar -zxvf nginx-sticky-mole-1.1.tar.gz
(3) 下载 nginx
[root@localhost local]# wget http://nginx.org/download/nginx-1.7.8.tar.gz
(4) 新建一个 Nginx 目录
[root@localhost /]# cd home
[root@localhost home]# mkdir Nginx
(5) 将 tar 包移动到 /home/Nginx 目录下面
[root@localhost local]# mv nginx-1.7.8.tar.gz /home/Nginx
[root@localhost local]# cd /home/Nginx
(6) 将 tar 包解压
[root@localhost Nginx]# tar -zxvf nginx-1.7.8.tar.gz
[root@localhost Nginx]# cd nginx-1.7.8
[root@localhost nginx-1.7.8]#
./configure --prefix=/usr/local/nginx-1.7.8 --with-http_ssl_mole --with-http_spdy_mole --with-http_stub_status_mole --with-pcre
make && make install
(7) 验证安装是否成功
[root@localhost /]# cd /usr/local/nginx-1.7.8/sbin
[root@localhost sbin]# ./nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
(8) 启动 nginx
[root@localhost sbin]# ./nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
使用命令关闭占用80端口的程序 sudo fuser -k 80/tcp
[root@localhost sbin]# ./nginx
(9) 浏览器访问:成功
至此,Nginx 安装完毕;