标签:class download dev Opens 编译 name nobody make apt-get
Ubuntu版本信息:
root@yatces-virtual-machine:~# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.5 LTS"
安装nginx版本:
nginx-1.11.3
1.安装nginx依赖库
1.1安装pcre依赖库
root@yatces-virtual-machine:~# apt-get install libpcre3 libpcre3-dev
root@yatces-virtual-machine:~# apt-get install zlib1g-dev
root@yatces-virtual-machine:~# apt-get install openssl
2.安装nginx
root@yatces-virtual-machine:/usr/local/soft# wget http://nginx.org/download/nginx-1.11.3.tar.gz
2.2解压
root@yatces-virtual-machine:/usr/local/soft# tar -zxvf nginx-1.11.3.tar.gz
2.3进入nginx目录配置
root@yatces-virtual-machine:/usr/local/soft# cd nginx-1.11.3/
root@yatces-virtual-machine:/usr/local/soft/nginx-1.11.3# ./configure --prefix=/usr/local/nginx
可以通过./configure --help查看需要配置的参数
root@yatces-virtual-machine:/usr/local/soft/nginx-1.11.3# ./configure --help
--help print this message --prefix=PATH set installation prefix --sbin-path=PATH set nginx binary pathname --modules-path=PATH set modules path
2.5编译、安装
root@yatces-virtual-machine:/usr/local/soft/nginx-1.11.3# make root@yatces-virtual-machine:/usr/local/soft/nginx-1.11.3# make install
如果make的时候报错,提示“pcre.h No such file or directory”,需要安装 libpcre3-dev依赖。
2.6启动nginx
安装完后在/usr/local/nginx/sbin目录下有个nginx命令
root@yatces-virtual-machine:/usr/local/nginx/sbin# ls nginx
启动
root@yatces-virtual-machine:/usr/local/nginx/sbin# ./nginx
后面可以加上-c 指定配置文件的位置,不加nginx会自动加载默认配置文件。
root@yatces-virtual-machine:/usr/local/nginx/sbin# ./nginx -c /usr/local/nginx/conf/nginx.conf
查看nginx进程
root@yatces-virtual-machine:/usr/local/nginx/sbin# ps -ef|grep nginx root 11975 1 0 14:57 ? 00:00:00 nginx: master process ./nginx nobody 11976 11975 0 14:57 ? 00:00:00 nginx: worker process root 11978 11883 0 14:57 pts/2 00:00:00 grep --color=auto nginx
标签:class download dev Opens 编译 name nobody make apt-get
原文地址:https://www.cnblogs.com/Yatces/p/11388811.html