ubuntu下nginx的安装

来源:互联网 发布:string数组 添加 编辑:程序博客网 时间:2024/05/23 22:12

接下来总结nginx的两种安装方式,命令安装和源码编译安装,整理于网络,记录下来便于日后查看

一、nginx的命令安装:
1、安装”software-properties-common”包。

sudo apt-get software-properties-common

2、添加nginx库到apt-get source中.

sudo add-apt-repository ppa:nginx/stable

3、安装nginx:

sudo apt-get install nginx

4、启动:

sudo /etc/init.d/nginx start

至此,nginx就安装完成了。

二、nginx源码编译安装:
1、选定源码目录

cd /home/st/software

我选择的是我的用户目录下software文件夹
2、安装pcre库

cd /home/st/softwarewget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gztar -zxvf pcre-8.37.tar.gzcd pcre-8.37./configuremakemake install

3、安装zlib库

cd /home/st/softwarewget http://zlib.net/zlib-1.2.8.tar.gztar -zxvf zlib-1.2.8.tar.gzcd zlib-1.2.8./configuremakemake install

4、安装ssl

cd /home/st/softwarewget http://www.openssl.org/source/openssl-1.0.1c.tar.gztar -zxvf openssl-1.0.1c.tar.gz

5、安装nginx

cd /home/st/softwarewget http://nginx.org/download/nginx-1.6.3.tar.gztar -zxvf nginx-1.6.3.tar.gzcd nginx-1.6.33./configure --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module with-pcre=/home/st/software/pcre-8.37 --with-zlib=/home/st/software/zlib-1.2.8 --with-openssl=/home/st/software/openssl-1.0.1cmakemake install

6、启动

sudo /usr/local/nginx/nginx
0 0
原创粉丝点击