linux安装nginx,并运行

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_22701869/article/details/82779192

第一步:安装源码编译方式:

安装make:yum -y install autoconf automake make

安装g++: yum -y install gcc gcc-c++ 

#一般系统中已经装了了make和g++,无须再装

第二步、安装nginx依赖的库

yum -y install pcre pcre-devel    

yum -y install zlib zlib-devel

yum install -y openssl openssl-devel

第三步、 下载nginx到指定的文件夹(如果没有安装wget,使用:yum -y install wget 安装)

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

第四步、解压文件

tar -zxvf nginx-1.9.0.tar.gz

第五步、进入解压好的文件

cd nginx-1.9.0

第六步、配置安装目录信息,执行下面命令

./configure   --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module 

#配置

#--prefix指定安装目录

#--with-http_ssl_module安装https模块

#creating objs/Makefile 代表编译成功

第七步、编译安装

make && make install

这两步也可以分开来进行操作

#make编译

#make install安装

 

安装好之后,就会在/usr/local/nginx中出现四个目录:

打开sbin目录:cd sbin/

执行:./nginx即运行nginx

测试访问nginx首页:curl (你自己的地址端口)http://172.17.0.2

安装访问就到这里,还有其他信息想了解,请访问我的nginx专栏!

 

猜你喜欢

转载自blog.csdn.net/qq_22701869/article/details/82779192
今日推荐