1. 程式人生 > >Ubuntu14.04下安裝Nginx伺服器

Ubuntu14.04下安裝Nginx伺服器

Nginx選擇1.9以上版本,支援tcp包轉發。

1、選定安裝目錄,例如/home/deploy/
2、安裝PCRE庫:
tar -zxvf pcre-8.34.tar.gz
cd pcre-8.34
./configure
make
make install
(如果預設沒有C編譯器,使用
apt-get install build-essential安裝)
3、安裝zlib庫
tar -zxvf zlib-1.2.5.tar.gz
cd zlib-1.2.5
./configure
make
make install
4、安裝nginx
tar -zxvf nginx-1.10.0.tar.gz
cd nginx-1.10.0

--以下配置項根據實際情況修改


./configure --prefix=/home/deploy/software/nginx-1.10.0 --conf-path=/home/deploy/software/nginx-1.10.0/conf/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --user=deploy --group=deploy --with-http_realip_module --with-http_sub_module --with-http_flv_module --with-http_dav_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_addition_module --with-pcre=/home/deploy/software/pcre-8.34 --with-zlib=/home/deploy/software/zlib-1.2.5 --with-stream

make
make install
5、啟動nginx
/home/deploy/software/nginx-1.10.0/sbin/nginx
6、關閉nginx
pkill -9 nginx
7、重新載入nginx,不需要重啟使配置生效
/sbin/nginx -s reload