linux下安装nginx1.10,Linux(RHEL7.0)下安装nginx-1.10.2(示例代码)
查看當(dāng)前系統(tǒng)版本是否支持
當(dāng)前,nginx發(fā)布包支持以下Linux操作系統(tǒng)版本:
RHEL/CentOS:
Version
Supported Platforms
5.x
x86_64, i386
6.x
x86_64, i386
7.x
x86_64, ppc64le
Debian:
Version
Codename
Supported Platforms
7.x
wheezy
x86_64, i386
8.x
jessie
x86_64, i386
Ubuntu:
Version
Codename
Supported Platforms
12.04
precise
x86_64, i386
14.04
trusty
x86_64, i386, aarch64/arm64
16.04
xenial
x86_64, i386, ppc64el
SLES:
Version
Supported Platforms
12
x86_64
我們可以在命令行輸入命令 "cat /etc/os-release" 查看當(dāng)前操作系統(tǒng)版本,如下所示:
[[email?protected] 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
可見(jiàn),操作系統(tǒng)屬于RHEL7.X,符合要求。
下載
可以輸入wget http://nginx.org/download/nginx-1.10.2.tar.gz 命令直接從網(wǎng)上獲取資源包,也可以自己下載。
我這里直接從官網(wǎng)下載nginx-1.10.2.tar.gz包,并放到/usr/local目錄下;
輸入tar -zxvf nginx-1.10.2.tar.gz命令解壓。
配置
進(jìn)入解壓后的目錄:
cd /usr/local/nginx-1.10.2
開(kāi)始配置,可以配置各種參數(shù)以及是否啟用某些模塊等,,詳細(xì)配置參數(shù)可參考官網(wǎng),有很詳細(xì)的說(shuō)明,
如下,是我的配置:
./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
啟動(dòng)服務(wù)
進(jìn)入sbin目錄,輸入nginx命令即可,另外重啟命令是nginx -s reload
驗(yàn)證服務(wù)是否啟動(dòng)
查看進(jìn)程即可,如下是我的nginx服務(wù)進(jìn)程
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
遇到的問(wèn)題
1、"conf/koi-win" 與"/usr/local/nginx/conf/koi-win" 為同一文件”
配置的時(shí)候,加上--conf-path參數(shù)的配置即可。
2、nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
端口被占用了,修改端口號(hào)即可。我這里是有個(gè)tomcat的端口配置為80,改成其它的即可。
總結(jié)
以上是生活随笔為你收集整理的linux下安装nginx1.10,Linux(RHEL7.0)下安装nginx-1.10.2(示例代码)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: manjaro linux 关机,给本子
- 下一篇: Linux中常用文件的含义