源碼安裝nginx

準備工作

1)確保以安裝開發工具和開發庫

2)卸載已安裝的其他web服務軟件

3)新建用戶:nginx

4)安裝依賴庫

# yum -y install pcre-devel


1、解包

[root@web01 nginx-package]# tar -zxfnginx-0.8.55.tar.gz



2、配置

./configure常用選項

--prefix=PATH  //指定安裝路徑

--user=USER

--group=GROUP

//爲進程設置非特權用戶的組

--with-http_stub_status_module  //添加stub模塊

--with-http_ssl_module//添加ssl模塊


[root@web01 nginx-0.8.55]# ./configure--prefix=/usr/local/nginx --user=nginx  --group=nginx  --with-http_stub_status_module   --with-http_ssl_module



3、編譯安裝

[root@web01 nginx-0.8.55]# make &&make install




4、將nginx加入環境變量

[root@web01 ~]# vim .bash_profile
10 PATH=$PATH:$HOME/bin:/usr/local/nginx/sbin
[root@web01 ~]# source .bash_profile



5、啓動nginx,並查看狀態


[root@web01 ~]# nginx
[root@web01 ~]# netstat -anltp | grep nginx
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      8212/nginx       
[root@web01 ~]#

監聽端口80

進程名:nginx

傳輸協議:tcp


6、訪問測試


[root@web01 ~]# elinks --dump http://localhost
                               Welcome to nginx!
[root@web01 ~]#



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章