安装Nginx

阅读量: 378 编辑

安装Nginx

一、下载 Nginx

cd /root
wget http://nginx.org/download/nginx-1.9.5.tar.gz

或者从这里下载

https://jeeweixin.com/article/1417253081841696

二、安装准备

依赖的软件安装

yum -y install pcre* zlib* zlib-devel* gcc* gcc-c++* glibc* autoconf* automake*  libxml* ncurses-devel* libgcrypt* libtool* bison* cmake* make* openssl* unzip* 

三、安装Nginx

cd /root

tar -zxvf nginx-1.9.5.tar.gz

cd nginx-1.9.5

./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --with-pcre --with-http_v2_module --with-http_gzip_static_module --with-ld-opt="-Wl,-E" --with-stream

make
make install

四、启动Nginx

/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

nginx默认是80端口,如果其他服务器占用了80端口,要把进程停掉,再启动nginx