Linux下Nginx服務安裝配置

Linux下Nginx服務安裝配置
1、Nginx介紹
  Nginx是一個高性能的HTTP和反向代理服務器,由俄羅斯人開發的,第一個版本發佈於2004年10月4日。Nginx由於出色的性能,在世界範圍內受到了越來越多人的關注,其特點是佔有內存少,併發能力強,nginx的併發能力確實在同類型的網頁服務器中是很強的,國內BAT、163、新浪等等都在使用nginx進行服務發佈和管理。Nginx還對負載均衡等提供了非常方便的配置,同時Nginx衆多的插件和功能集成更是讓Nginx成爲某些WEB應用場景的不二選擇。以上的內容或許稍顯誇張,只因爲鄙人是Nginx的忠實粉絲,見仁見智吧,起碼Nginx是一種非常好的選擇。
  Nginx官網地址:http://nginx.org/
  2、Nginx服務安裝
  Nginx提供了對主流Linux操作系統的支持,Windwos下也有相應的版本,但由於操作系統的一些限制,在Windows操作系統上部分功能缺失,在性能上也也較大的差距。Nginx在windows上安裝配置:http://nginx.org/en/docs/windows.html
  Linux下Nginx也提供了標準的RPM包,直接安裝後配置即可使用,非常方便。但標準包裏的組件都是是固定的,對以後組件的擴展等不是很好,而且路徑的配置也比較固定。
  使用標準包安裝地址:
  命令如下:rpm -ivh http://nginx.org/packages/CentOS/7/noarch/RPMS/nginx-release-centos-7-0.el6.ngx.noarch.rpm
  這裏我選擇了源碼編譯安裝。安裝步驟如下:
  1>安裝依賴庫
[root@rk /]#yum install gcc-c++ yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel
[root@rk /]#yum -y install gcc automake autoconf libtool make
  2>創建安裝目錄,下載安裝包
[root@rk /]#mkdir /usr/nginx[root@rk /]#chmod 777 /usr/nginx[root@rk /]#cd /usr/nginx[root@rk nginx]#cd wget http://nginx.org/download/nginx-1.9.4.tar.gz
  3>解壓配置
[root@rk nginx]#tar -zxvf nginx-1.9.4.tar.gz[root@rk nginx]#cd nginx-1.9.4[root@rk nginx-1.9.4]#./configure --prefix=/usr/webserver/nginx --sbin-path=/usr/webserver/nginx --conf-path=/usr/webserver/nginx/nginx.conf --error-log-path=/home/databak/log/nginx/error.log --http-log-path=/home/databak/log/nginx/access.log --pid-path=/usr/webserver/nginx/run/nginx.pid --lock-path=/usr/webserver/nginx/run/nginx.lock --http-client-body-temp-path=/home/databak/cache/nginx/client_temp --http-proxy-temp-path=/home/databak/cache/nginx/proxy_temp --http-fastcgi-temp-path=/home/databak/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/home/databak/cache/nginx/uwsgi_temp --http-scgi-temp-path=/home/databak/cache/nginx/scgi_temp --with-http_image_filter_module --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-mail --with-mail_ssl_module --with-file-aio --with-http_spdy_module --with-ipv6 --with-threads --with-stream --with-stream_ssl_module
  4>編譯
[root@rk nginx-1.9.4]#make && make install
  編譯成功後Nginx就安裝好了。
  5>重啓服務
[root@rk nginx]#./nginx -c nginx.conf
   6>測試
  瀏覽器中輸入Nginx地址,出現如下畫面則安裝啓動完成

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