Linux安装nginx
1. 确认gcc g++开发类库是否安装好
安装make yum -y install gcc automake autoconf libtool make 安装g++ yum install gcc gcc-c++
2. 选定安装目录
进入/usr/local/src
cd /usr/local/src
3. 安装PCRE库
cd /usr/local/src wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz tar -zxvf pcre-8.37.tar.gz cd pcre-8.34 ./configure make make install
4. 安装zlib库
cd /usr/local/src wget http://zlib.net/zlib-1.2.11.tar.gz tar -zxvf zlib-1.2.11.tar.gz cd zlib-1.2.11 ./configure make make install
5. 安装openssl
cd /usr/local/src wget https://www.openssl.org/source/openssl-1.0.1t.tar.gz tar -zxvf openssl-1.0.1t.tar.gz
6. 安装nginx
cd /usr/local/src wget http://nginx.org/download/nginx-1.1.10.tar.gz tar -zxvf nginx-1.1.10.tar.gz cd nginx-1.1.10 ./configure make make install
7. 启动nginx
vim /usr/local/nginx/conf/nginx.conf server{ listen 8009; server_name localhost; }
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
8. 停止nginx
1. 查看进程号 ps -ef | grep nginx 2. 杀死进程 kill -QUIT 进程号 3.强制停止 pkill -9 nginx 4.重启nginx cd /usr/local/nginx/sbin ./nginx -s reload