Linux(RHEL7.0)下安裝nginx-1.10.2,nginx1.10linux安裝

來源:互聯網
上載者:User

Linux(RHEL7.0)下安裝nginx-1.10.2,nginx1.10linux安裝
查看當前系統版本是否支援

當前,nginx發布包支援以下Linux作業系統版本:

RHEL/CentOS:

VersionSupported Platforms
5.xx86_64, i386
6.xx86_64, i386
7.xx86_64, ppc64le

Debian:

VersionCodenameSupported Platforms
7.xwheezyx86_64, i386
8.xjessiex86_64, i386

Ubuntu:

VersionCodenameSupported Platforms
12.04precisex86_64, i386
14.04trustyx86_64, i386, aarch64/arm64
16.04xenialx86_64, i386, ppc64el

SLES:

VersionSupported Platforms
12x86_64

我們可以在命令列輸入命令 "cat /etc/os-release" 查看當前作業系統版本,如下所示:

[root@localhost local]# cat /etc/os-release
NAME="Red Hat Enterprise Linux Server"
VERSION="7.0 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="7.0"
PRETTY_NAME="Red Hat Enterprise Linux Server 7.0 (Maipo)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.0:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.0
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION=7.0

可見,作業系統屬於RHEL7.X,符合要求。

下載

可以輸入wget http://nginx.org/download/nginx-1.10.2.tar.gz 命令直接從網上擷取資源套件,也可以自己下載。

我這裡直接從官網下載nginx-1.10.2.tar.gz包,並放到/usr/local目錄下;

輸入tar -zxvf nginx-1.10.2.tar.gz命令解壓。

配置

進入解壓後的目錄:

cd /usr/local/nginx-1.10.2

開始配置,可以配置各種參數以及是否啟用某些模組等,,詳細配置參數可參考官網,有很詳細的說明,

http://nginx.org/en/docs/configure.html

如下,是我的配置:

./configure --prefix=/usr/local/nginx-1.10.2 --conf-path=/usr/local/nginx-1.10.2/nginx.conf --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --with-mail --with-mail_ssl_module
編譯

輸入以下命令即可:

make && make install 
啟動服務

進入sbin目錄,輸入nginx命令即可,另外重啟命令是nginx -s reload

驗證服務是否啟動

查看進程即可,如下是我的nginx服務進程

root     20646     1  0 11:04 ?        00:00:00 nginx: master process nginx
nobody   20647 20646  0 11:04 ?        00:00:00 nginx: worker process遇到的問題

1、"conf/koi-win" 與"/usr/local/nginx/conf/koi-win" 為同一檔案”

配置的時候,加上--conf-path參數的配置即可。

2、nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

連接埠被佔用了,修改連接埠號碼即可。我這裡是有個tomcat的連接埠配置為80,改成其它的即可。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.