Nginx服务配置 (一) 起步

本文详细介绍在CentOS7环境中安装Nginx的过程,包括安装编译器、依赖库,下载Nginx并配置服务,以及启动、重启和停止Nginx的方法。

Nginx作为后起之秀,市场占有程度暂时没有Apache高。但是未来替代Apache是趋势,目前Nginx需要就是等待时间来证明它的稳定性。

  • 优点:支持高并发、对内存耗费低、开源软件成本低....
  • 缺点:资料少

 

目的:本文主要是在Centos7.x环境下安装并运行nginx服务

 

准备


Linux系统环境 CentOS7.5 64bit

[root@VM_16_8_centos nginx]# uname -a
Linux VM_16_8_centos 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

 

起步


1.安装gcc编译器等工具

[root@VM_16_8_centos ~]# yum -y install gcc gcc-c++ autoconf automake


2.安装依赖

[root@VM_16_8_centos ~]# yum install -y zlib zlib-devel openssl openssl-devel pcre pcre-devel

3.下载安装

[root@VM_16_8_centos ~]# yum install -y nginx

4.启动服务程序 查看服务状态 将服务加入开机启动项

[root@VM_16_8_centos ~]# systemctl start nginx
[root@VM_16_8_centos ~]# systemctl status nginx
[root@VM_16_8_centos ~]# systemctl enable nginx
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.

5.重启nginx

[root@VM_16_8_centos ~]# systemctl restart nginx

6.停止nginx

[root@VM_16_8_centos ~]# systemctl stop  nginx

 

 

效果

启动nginx服务后,可以用浏览器访问ip地址

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

hinzer

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值