Linux 安装nginx

1、百度搜索Nginx,点击Nginx news官网,点击nginx-1.13.10进入下载网页,选择Stable version的版本之后下载。


2、进入根目录,cd /


3、在根目录下创建software文件夹:mkdir software,并且授权777权限: chmod -R 777 software


4、把下载的nginx-1.12.2.tar.gz放入software文件夹下,


5、解压tar文件,tar -zxvf nginx-1.12.2.tar.gz


6、进入解压后的nginx-1.12.2文件夹


7、输入./configure  报错./configure: error: cc compiler is not found,说明需要安装    gcc 和gcc-c++


8、退出到根目录:cd /, 输入yum -y install gcc gcc-c++ autoconf automake 即解决    上一个问题


9、再次进入nginx-1.12.2文件夹,再次输入./configure 报错./configure: error: the    HTTP rewrite module requires the PCRE library. 说明需要安装PCRE库


10、再次退出到根目录:cd /, 输入yum -y install pcre pcre-devel 即解决上一个问题


11、再次进入nginx-1.12.2文件夹,输入./configure  报错:./configure: error: the HTTP gzip module requires the zlib library. 说明需要安装zlib库
12、再次退出到根目录:cd /, 输入yum -y install zlib zlib-devel  即解决上一个问题


13、再次进入nginx-1.12.2文件夹,输入./configure 没有报错


14、输入make

15、最后输入make install 安装成功

测试安装是否成功

 

1、退出到根目录;cd /

2、进入usr/local目录:cd /usr/local

3、查看该目录下是否有ginx文件夹,如果有证明环境搭建成功

4、nginx启动命令/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

 

posted @ 2020-06-15 15:41  新进社员  阅读(173)  评论(0编辑  收藏  举报