1. 程式人生 > >Linux(centOS 7.2)下nginx安裝步驟

Linux(centOS 7.2)下nginx安裝步驟

1、gcc安裝
檢視是否有gcc
gcc -v
沒有需要安裝gcc,執行以下命令
yum -y install gcc gcc-c++ autoconf pcre pcre-devel make automake
yum -y install wget httpd-tools vim
檢視gcc -v 若報 comand not found,再執行
yum -y install gcc automake autoconf libtool make
cc -v檢視能看到版本
gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC)

2、PCRE庫安裝
yum install pcre pcre-devel

3、zlib庫安裝
yum install zlib zlib-devel

4、OpenSSL庫安裝
yum install openssl openssl-devel

期間可能遇到以下錯誤:
若報錯如下:
make: * No rule to make target build', needed bydefault’. Stop.

說明有依賴庫沒安裝 ,繼續安裝上述幾個庫。

另外上述幾個庫安裝過程中,可能報如下錯誤
Error: Multilib version problems found. This often means that the root
cause is something else and multilib version checking is just
pointing out that there is a problem. Eg.:

     1. You have an upgrade for zlib which is missing some
        dependency that another package requires. Yum is trying to
        solve this by installing an older version of zlib of the
        different architecture. If you exclude the bad architecture
        yum will tell you what the root cause is (which package
        requires what). You can try redoing the upgrade with
        --exclude zlib.otherarch ... this should give you an error
        message showing the root cause of the problem.

     2. You have multiple architectures of zlib installed, but
        yum can only see an upgrade for one of those architectures.
        If you don't want/need both architectures anymore then you
        can remove the one with the missing update and everything
        will work.

     3. You have duplicate versions of zlib installed already.
        You can use "yum check" to get yum show these errors.

   ...you can also use --setopt=protected_multilib=false to remove
   this checking, however this is almost never the correct thing to
   do as something else is very likely to go wrong (often causing
   much more problems).

上述常見原因是有兩個版本的庫。

用以下命令檢視zlib庫:
[[email protected]_0_14_centos ~]# rpm -qa | grep zlib
zlib-1.2.7-15.el7.i686
zlib-1.2.7-15.el7.x86_64

然後用以下命令刪除其中一個版本
[[email protected]_0_14_centos ~]# yum erase zlib-1.2.7-15.el7.i686

假設你上述庫都安裝完成後

5、到 usr/local目錄下下週nginx安裝包進行安裝,建議安裝在改目錄下,否則在全域性下沒有nginx命令,需要加軟連線,用該命令解決,加入你沒安裝在usr/local下,後者為你的安裝目錄
[[email protected]_0_14_centos nginx-1.14.0]# /usr/local/nginx/sbin/nginx -c /root/nginx-1.14.0/conf/nginx.conf

6、安裝步驟:分別執行以下命令
wget http://nginx.org/download/nginx-1.1.10.tar.gz
tar -zxvf nginx-1.1.10.tar.gz
cd nginx-1.1.10
./configure
make
make install

7、修改nginx配置
到nginx安裝目錄下,用vim 開啟命令開啟nginx.conf
因為可能apeache佔用80埠,apeache埠儘量不要修改,我們選擇修改nginx埠。
開啟後server中的listen是監聽的埠 預設80,修改為8090 或者你想要的埠。

最後一步

8、啟動nginx
nginx -s reload

然後至瀏覽器中檢視是否啟動好,貼上我的圖
這裡寫圖片描述

相關推薦

Linux(centOS 7.2)nginx安裝步驟

1、gcc安裝 檢視是否有gcc gcc -v 沒有需要安裝gcc,執行以下命令 yum -y install gcc gcc-c++ autoconf pcre pcre-devel make automake yum -y install wget

CentOS 7.2 nginx SSL證書部署的方法(使用crt以及key 配置)

轉自:https://www.jb51.net/article/107350.htm   環境 系統環境:CentOS6.7 nginx version: nginx/1.8.1 證書 ?

Linux centOS 7.2 命令列 靜默安裝部署oracle11g資料庫

Linux  centOS命令列下 安裝部署oracle11g資料庫       小編今天給大家帶來Linux系統,Linux命令列下部署 oracle安裝部署資料庫,因為在Linux命令列來部署,所以在安裝部署oracle資料庫前,我們得進行檢查和設定,有以下步驟:一、檢查

linux(騰訊雲centOS 7.2)安裝nodejs環境

步驟2:解壓 xz -d node-v10.2.0-linux-x64.tar.xz 步驟3:再解壓 tar -xvf node node-v10.2.0-linux-x64.tar 步驟4:安裝了node,並不是所有資料夾下都能使用,需要建立nod

CentOS 7.2安裝Mono 5.0

nbsp 很好 all win ack style 領域 logs 平臺 微軟Build2017大會期間.NET領域的.NET core之外,就是Visual Studio For Mac,大家都知道Visual Studio For Mac 是基於Mono運行的,Mono

CentOS 7.2上編譯安裝Nginx 1.13.6

創建 ont uname group with pen 還需 www stub 第一個裏程碑 --- 檢查軟件安裝的系統環境 [root@rainjin ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (

CentOS 7.2 mysql 8.0.11二進制安裝(親測)

type server png not tex 分享 chown sed tar 本文主要介紹mysql 8.0.11二進制安裝,具體步驟如下1. 解壓文件tar -zxvf mysql-8.0.11-el7-x86_64.tar.gz2. 移動解壓後的數據庫文件mv my

CentOS 7.4原始碼安裝 Apache HTTP Server(httpd-2.4.35)

CentOS 7.4下原始碼安裝 Apache HTTP Server(httpd-2.4.35) 前提:確保安裝了expat-devel, APR包 (apr-1.6.3.tar.gz 和 apr-util-1.6.1.tar.gz); 用YUM方式安裝expat-devel 和 apr-ut

centos 6.x和7.x nginx安裝與配置

一、安裝gcc(命令:yum install gcc)   備註:可以輸入gcc -v 查詢版本資訊,看系統是否自帶安裝 二、安裝pcre(命令: yum install pcre-devel) 三、安裝zlib 四、安裝openssl 綜合命令:   yum -y inst

CentOS 7.2安裝lamp環境

環境: CentOS 7.2 64位 1.安裝Apache # yum install httpd 安裝成功後啟動一下httpd服務 # service httpd start 在瀏覽器輸入ip訪問,頁面如下: 2.安裝mysql

CentOS 7.2安裝PXC 5.7.21

PXC的安裝非常簡單。 --軟體下載 https://www.percona.com/downloads/Percona-XtraDB-Cluster-57/LATEST/ --基礎環境準備 [[email protected] ~]# vim /etc/hosts  ---在3個

centOs 7.2*64 nginx精簡安裝教程

 在伺服器新建個資料夾放nginx下載包 mkdir ./nginx cd ./nginx  跳轉到nginx檔案下載 wget http://nginx.org/download/nginx-1.13.0.tar.gz 解壓 tar -xvf ./(nginx的檔

CentOS 7.2安裝Python 3.6.2

檢視python2.7 1、下載:wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz 2、解壓:tar -xvJf  Python-3.6.2.tar.xz     或者 xz -d Pytho

CentOS 7.2 安裝 Hadoop 2.7.5 並搭建偽分散式環境的方法

資源下載 一、建立 Hadoop 使用者 建立 hadoop 使用者,並分配以使用者名稱為家目錄/home/hadoop,並將其加入到sudo使用者組,建立好使用者之後,以 hadoop 使用者登入: sudo useradd

Linux CentOS 7環境安裝MySQL

在CentOS 7中預設安裝有MariaDB,但是我們需要的是MySQL,安裝MySQL可以覆蓋MariaDB。 (注:MariaDB資料庫管理系統是MySQL的一個分支,主要由開源社群在維護,採用GPL授權許可。開發這個分支的原因之一是:甲骨文公司收購了MySQL後,有將MySQL閉源的潛在風險,因此社群

Jenkins 安裝linux CentOS 7.2

前言:路漫漫其修遠兮,我們一起來努力!!!1  基礎軟體環境1.centos7.22.Jdk 1.83.maven-3.5.34.Tomcat(Jenkins也自帶有Jetty伺服器,可使用“service jenkins start”來開啟安裝後的Jenkins服務,如需使

Linux CentOS 7.0 rar unrar的安裝

CentOS 7.0 64位平臺,執行以下命令:(http://www.rarlab.com)官網可以檢視最新的版本 下載:   wget http://www.rarlab.com/rar/rarlinux-x64-5.3.0.tar.gz 解壓:   tar -xz

Linux Centos 7.2安裝指定版本Docker 17.03

code style tps com 註意 時間 可能 mapper git https://docs.docker.com/install/linux/docker-ce/centos/#install-docker-ce   先清空下“歷史&

centos 7.2 為erlang添加protobuffs

per 代碼 brush 協議 讀取 ger required mpi 會有 安裝前提: 1.已經安裝好erlang otp 2.配置了rebar (配置方法:http://www.cnblogs.com/panfeng412/archive/2011/08/14/2

Linux(CentOS 7)命令行模式安裝VMware Tools 詳解

模式 pre rtx 圖形界面 啟動圖 tar.gz term directory 文件解壓 本篇文章主要介紹了如何在Linux(CentOS 7)命令行模式安裝VMware Tools,具有一定的參考價值,感興趣的小夥伴們可以參考一下。 本例中為在Linux(以CentO