新聞中心
Nginx是一個(gè)高性能的HTTP和反向代理web服務(wù)器,同時(shí)也提供了IMAP/POP3/SMTP服務(wù)。其特點(diǎn)是占有內(nèi)存少,并發(fā)能力強(qiáng),事實(shí)上nginx的并發(fā)能力在同類(lèi)型的網(wǎng)頁(yè)服務(wù)器中表現(xiàn)較好,本篇文章重點(diǎn)為大家講解一下Linux中Nginx安裝與配置。

簡(jiǎn)單安裝
本教程一Centos 6.3為例講解,軟件包可以在官方網(wǎng)站下載,編譯安裝之前,我們需要使用YUM提前將所需的軟件依賴(lài)包安裝完成。
安裝命令如下:
[root@centos6 ~]# wget http://nginx.org/download/nginx-1.4.0.tar.gz
[root@centos6 ~]# tar -xzf nginx-1.4.0.tar.gz -C /usr/src
[root@centos6 ~]# yum -y install gcc pcre pcre-devel openssl \
>openssl-devel gd gd-devel perl perl-ExtUtils-Embed
[root@centos6 ~]# cd /usr/src/nginx-1.4.0/
[root@centos6 nginx-1.4.0]# ./configure --prefix=/usr/local/nginx \
>--with-ipv6 \
>--with-http_ssl_module \
>--with-http_realip_module \
>--with-http_addition_module \
>--with-http_dav_module \
>--with-http_flv_module \
>--with-http_mp4_module \
>--with-http_gzip_static_module \
>--with-http_perl_module \
>--with-mail \
>--with_main_ssl_module
[root@centos6 nginx-1.4.0]# make && make install
Nginx Web服務(wù)器軟件安裝完成后,程序主目錄位于/usr/local/nginx/,該目錄下的內(nèi)容分別為cong、html、logs、sbin。下面是Nginx常用的進(jìn)程管理指令:
[root@centos6 ~]# /usr/local/nginx/sbin/nginx #啟動(dòng)主程序
[root@centos6 ~]# /usr/local/nginx/sbin/nginx -c \ #指定配置文件啟動(dòng)主程序
[root@centos6 ~]# /usr/local/nginx/sbin/nginx -s stop #關(guān)閉主程序
[root@centos6 ~]# /usr/local/nginx/sbin/nginx -s reload #重新加載設(shè)置
配置文件解析
Nginx默認(rèn)的配置文件為/usr/local/nginx/conf/nginx.conf,配置文件包括全局、event、http、server設(shè)置,event主要用來(lái)定義Nginx工作模式,http提供Web功能,server用來(lái)設(shè)置虛擬主機(jī),server必須位于http內(nèi)部,一個(gè)配置文件中可以有多個(gè)server。
本文名稱(chēng):Linux中Nginx安裝與配置
URL地址:http://www.dlmjj.cn/article/cosjeeo.html


咨詢(xún)
建站咨詢(xún)
