CentOs7如何安装nginx?

首先来说一下nginx是什么有什么作用,nginx是俄罗斯人开发的一个开源的高性能的服务器软件,他主要用来左负载均衡或者反向代理解决跨域问题等。

  1. nginx安装:

1、安装必备工具工具(假设没有安装的话)

yum -y install wget gcc gcc-c++

2、使用wget下载nginx

wget http://nginx.org/download/nginx-1.14.0.tar.gz

3、解压下载下来的安装包

tar -zxvf 你的安装包名

4、安装依赖包

yum -y install pcre-devel openssl-devel

5、编译安装nginx

cd nginx解压的目录
./configure\
--prefix=/usr/local/nginx \
--with-http_ssl_module

6、通过make命令编译和安装nginx

make && make install

7、启动nginx

cd /usr/local/nginx/sbin
./nginx

8、访问测试

打开浏览器输入你的ip回车

9、出现如下界面代表安装成功

安装过程中出现的小插曲:

        因为nginx需要占用80端口,我们索性就把iptables装上,然后打开80端口,然后关闭所有占用80端口的程序,然后在启动nginx。 

猜你喜欢

转载自blog.csdn.net/qq_39429962/article/details/83591872