Nginx的安裝

  本文主要介紹Nginx的安裝流程,不包含配置。

    

1.配置安裝環境                      

yum groupinstall "Development Tools""Server Platform "
yum install pcre-devel openssl -devel

2.新建運行賬號:              

groupadd -r nginx
useradd -r -g nginx nginx

3.查看幫助文件:

             ./configure --help | less

4.編譯安裝:

#./configure --prefix=/usr/local/nginx --conf-path=/etc/nginx/nginx.conf --user=nginx --group=nginx --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_flv_module --with-http_mp4_module --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi
# make && make install

5.查看安裝狀態:

 /usr/local/nginx/sbin/nginx -t

6. 啓動nginx(未配置服務腳本之前):

  /usr/local/nginx/sbin/nginx

7.關閉nginx:

            killall nginx 

 8.服務腳本設置:

Vim /etc/rc.d/init.d/nginx 服務腳本,可根據提供文檔設置
chmod +x /etc/rc.d/init.d/nginx
chkconfig --add nginx
chkconfig --list nginx
service nginx start

9.啓動服務,運行正常頁面顯示如下:

wKioL1X6u3Th4rx8AAETZu8q8nY593.jpg

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