centos7下安装nginx1.10.1

寵の児 提交于 2019-11-27 15:56:53

centos7下安装nginx1.10.1,亲测可用

1首页进入要安装的文件夹下,执行下载安装命令

[root@localhost soft]# wget -c https://nginx.org/download/nginx-1.10.1.tar.gz

2安装前置库:

[root@localhost soft]# yum install -y gcc pcre pcre-devel openssl openssl-devel gd gd-devel

3解压,然后跳转到解压的目录下

[root@localhost soft]# tar -zxvf nginx-1.10.1.tar.gz

[root@localhost soft]# cd nginx-1.10.1

4进入nginx目录

[root@localhost nginx]# ./configure --prefix=/opt/nginx --sbin-path=/usr/bin/nginx

这里指定安装的目录是在:/opt/nginx 目录

5编译安装

[root@localhost nginx]# make && make install

6启动

Nginx可以通过命令行来启动,操作命令:

 启动:nginx

 停止:nginx -s stop

 重新加载: nginx -s reload

7放开80端口,关闭防火墙

CentOS 7.0默认使用的是firewall作为防火墙 ,如果不关闭,外面访问不了nginx

查看防火墙状态

firewall-cmd --state

停止firewall

systemctl stop firewalld.service 

禁止firewall开机启动

systemctl disable firewalld.service 

8访问ip,安装完成,浏览器默认80端口,nginx也默认80端口

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!