目录
一、准备配置环境
-
安装依赖包
apt-get install gcc
apt-get install libpcre3 libpcre3-dev
apt-get install zlib1g zlib1g-dev
# Ubuntu14.04的仓库中没有发现openssl-dev,由下面openssl和libssl-dev替代
#apt-get install openssl openssl-dev
sudo apt-get install openssl
sudo apt-get install libssl-dev
-
安装nginx
cd /usr/local
mkdir nginx
cd nginx
wget http://nginx.org/download/nginx-1.13.7.tar.gz
tar -xvf nginx-1.13.7.tar.gz
-
编译nginx
# 进入nginx目录
/usr/local/nginx/nginx-1.13.7
# 执行命令
./configure
# 执行make命令
make
# 执行make install命令
make install
-
启动nginx
#进入nginx启动目录
cd /usr/local/nginx/sbin
# 启动nginx
./nginx
注:
如果重启服务器/usr/local/nginx/logs目录下缺少 nginx.pid
在配置文件中取消