ubuntu 18 编译安装 nginx

1,安装依赖

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

2,从官网下载nginx

http://nginx.org/en/download.html

3,编译安装

#先解压
tar -zxvf xxx -C /home/lxj/nginx16
# 到解压后的目录里面执行命令
./configure
# 执行make命令
make
# 执行make install命令
make install

4,运行并验证

#进入nginx启动目录
cd /usr/local/nginx/sbin
# 启动nginx
sudo ./nginx

浏览器输入
localhost
#查看进程:
ps -ef | grep nginx

 

你可能感兴趣的:(Linux,nginx)