Linux_Nginx 安装笔记

来源:互联网 发布:免费的看书软件 编辑:程序博客网 时间:2024/05/29 07:38

环境:Vmware Workstation 10,CentOS-7-x86_64-DVD-1511.iso,Xshell 4.0,ip:192.168.216.140

[root@localhost ~]# yum list nginx* #yum查看nginx安装信息

已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.tuna.tsinghua.edu.cn
* extras: mirror.bit.edu.cn
* updates: mirror.bit.edu.cn
错误:没有匹配的软件包可以列出

[root@localhost ~]# yum list pcre pcre-devel zlib zlib-devel openssl openssl-devel

已安装的软件包
openssl.x86_64 1:1.0.1e-42.el7.9 @anaconda
pcre.x86_64 8.32-15.el7 @anaconda
zlib.x86_64 1.2.7-15.el7 @anaconda
可安装的软件包
openssl.x86_64 1:1.0.1e-60.el7_3.1 updates
openssl-devel.i686 1:1.0.1e-60.el7_3.1 updates
openssl-devel.x86_64 1:1.0.1e-60.el7_3.1 updates
pcre.i686 8.32-15.el7_2.1 base
pcre.x86_64 8.32-15.el7_2.1 base
pcre-devel.i686 8.32-15.el7_2.1 base
pcre-devel.x86_64 8.32-15.el7_2.1 base
zlib.i686 1.2.7-17.el7 base
zlib.x86_64 1.2.7-17.el7 base
zlib-devel.i686 1.2.7-17.el7 base
zlib-devel.x86_64 1.2.7-17.el7 base

[root@localhost ~]# yum install pcre pcre-devel zlib zlib-devel openssl openssl-devel #yum安装nginx所需依赖

[root@localhost ~]# rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm #rpm安装nginx yum repo源

[root@localhost ~]# yum list nginx #yum 再次查看nginx安装信息

已加载插件:fastestmirror
nginx | 2.9 kB 00:00:00
nginx/x86_64/primary_db | 24 kB 00:00:00
Loading mirror speeds from cached hostfile
* base: mirrors.tuna.tsinghua.edu.cn
* extras: mirror.bit.edu.cn
* updates: mirror.bit.edu.cn
可安装的软件包
nginx.x86_64 1:1.12.0-1.el7.ngx nginx

[root@localhost ~]# yum install nginx #yum安装nginx

[root@localhost ~]# service nginx start #启动nginx

Redirecting to /bin/systemctl start nginx.service

[root@localhost ~]# ps -ef | grep nginx #ps命令查看nginx进程

root 15531 1 0 11:27 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx 15532 15531 0 11:27 ? 00:00:00 nginx: worker process
root 15867 2681 0 11:31 pts/0 00:00:00 grep –color=auto nginx

[root@localhost ~]# service nginx status #service查看nginx运行状态

Redirecting to /bin/systemctl status nginx.service
● nginx.service - nginx - high performance web server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: active (running) since 三 2017-05-24 11:27:55 CST; 3min 47s ago

注意:下面两条命令“–”是两个“-”,csdn显示有误。

[root@localhost ~]# firewall-cmd –zone=public –add-port=80/tcp –permanent #防火墙永久开放80端口号

success

[root@localhost ~]# firewall-cmd –reload #重启防火墙是新开放的端口号生效

success

http://192.168.216.140/ #网页访问
这里写图片描述

原创粉丝点击