1.首先下载稳定版nginx1.10.2 使用wget命令下载
2.然后解压
tar -zxvf nginx-1.10.2.tar.gz
3.安装依赖库
sudo apt-get install libpcre3-dev aptitude libssl-dev
sudo apt-get install openssl
sudo apt-get install libssl0.9.8
sudo apt-get install libssl-dev
4.编译
./configure
成功会输出:
Configuration summary
+ using system PCRE library
.....
make && make install
make[1]: Leaving directory `/root/nginx' 成功
5.加入系统变量
sudo echo "PATH=$PATH:/usr/local/nginx/sbin">> /etc/profile
sudo echo "export PATH">> /etc/profile
source /etc/profile
启动nginx
sudo nginx
停止nginx
sudo nginx -s stop
重启nginx
sudo nginx -s reload
nginx编译安装完毕
nginx配置文件在/usr/local/nginx/conf/nginx.conf