即将新官上任,有很多环境要自己搭建,现将自己搭建的每一个过程都记录下来,希望给自己做个保存,也想给有同样需要的朋友提供参考,减少不必要的时间
我用的是ubuntu11.04版本,绝对是全新的环境,参照的ngxin官网的英文步骤操作的
nginx官网安装步骤
http://nginx.org/en/docs/install.html
一、准备工作
a. 到ngxin官网下载nginx-1.3.14.tar.gz文件
b.下载所需的库,以下在各官网都能下到,pcre、openssl、zlib,这些都是ngxin安装过程中所必须的,必须先编译安装好,或者直接用apt-get install,本人想试一下源码安装,另外以后是负责网站环境,所以还是自己安装的好
二、开始安装
解压zlib、openssl、pcre库,供下面nginx安装使用
cd /usr/src tar zxvf zlib-1.2.7.tar.gz tar zxvf openssl-1.0.1e.tar.gz tar zxvf pcre-8.21.tar.gz
安装nginx
cd /usr/src tar nginx-1.3.14.tar.gz cd nginx-1.3.14 ./configure --prefix=/usr/local/nginx --with-openssl=../openssl-1.0.1e --with-pcre=../pcre-8.21 --with-zlib=../zlib-1.2.7 #这里的参数可以参考官网说明,每一项都很简单 make make install
至此nginx已经安装完成,在/usr/local/nginx目录下
但是ngxin还没有启动,此时先手动启动nginx
/usr/local/nginx/sbin/nginx ps -e | grep nginx 如果能看到nginx进程说明已经启动成功 wget http://localhost进行访问已经可以访问,或者直接用浏览器访问ip地址也可以看到nginx的 欢迎页面
三、将ngxin添加到服务,并且设为开机启动
cd /etc/init.d vi nginx 输入以下配置 #!/bin/bash # nginx Startup script for the Nginx HTTP Server # it is v.0.0.2 version. # chkconfig: - 85 15 # description: Nginx is a high-performance web and proxy server. # It has a lot of features, but it's not for everyone. # processname: nginx # pidfile: /var/run/nginx.pid # config: /usr/local/nginx/conf/nginx.conf nginxd=/usr/local/nginx/sbin/nginx nginx_config=/usr/local/nginx/conf/nginx.conf nginx_pid=/usr/local/nginx/logs/nginx.pid RETVAL=0 prog="nginx" # Check that networking is up. [[ ${NETWORKING} = "no" ]] && exit 0 [ -x $nginxd ] || exit 0 # Start nginx daemons functions. start() { if [ -e $nginx_pid ];then echo "nginx already running...." exit 1 fi echo -n $"Starting $prog: " $nginxd -c ${nginx_config} RETVAL=$? echo [ $RETVAL = 0 ] return $RETVAL } # Stop nginx daemons functions. stop() { echo -n $"Stopping $prog: " $nginxd -s stop RETVAL=$? echo [ $RETVAL = 0 ] } # reload nginx service functions. reload() { echo -n $"Reloading $prog: " pkill -HUP `cat ${nginx_pid}` #killproc $nginxd -HUP RETVAL=$? echo } # See how we were called. case "$1" in start) start ;; stop) stop ;; reload) reload ;; restart) stop start ;; status) status $prog RETVAL=$? ;; *) echo $"Usage: $prog {start|stop|restart|reload|status|help}" exit 1 esac exit $RETVAL 保存退出 chmod u+x nginx 此时服务nginx已经添加,以下命令就可以了 service nginx start service nginx stop service nginx restart service nginx reload service nginx status service nginx help 最后把nginx设为开机启动 update-rc.d -f nginx defaults 这样下次重启机器的时候,nginx就会自动启动了
相关推荐
NULL 博文链接:https://kevin1.iteye.com/blog/902769
ubuntu18.04下交叉编译(aarch64-linux-gnu)nginx1.18.0源码 支持H265编码的rtmp推流和HTTP-FLV拉流 适合安防、直播等领域的音视频推拉流工作
安装 Nginx sudo apt-get install nginx 如果你安装了 Apache ,并且此时 Apache 在运行,那么请先修改一下配置文件(没有的同学直接跳过): #打开配置文件 sudo vim /etc/nginx/sites-available/default ...
在任意linux环境下,解开nginx-install.zip,然后: 1、 sh install.nginx.sh 2、 sh conf.nginx.sh 即完成了nginx源码安装和配置
手把手ubunt下安装nginx web服务器,包括安装前提;nginx源码下载以及目录结构认识;nginx的编译和安装;nginx的启动和简单使用
nginx:ubuntu 14.04安装nginx包含并使用pcre openssl zlib源码添加nginx-rtmp-module模块
NULL 博文链接:https://zhengdl126.iteye.com/blog/435633
前面介绍了Ubuntu环境编译安装PHP和Nginx的方法,这里再来讲解一下源码编译安装xdebug的方法。 下载并解压xdebug xdebug下载地址:https://xdebug.org/download.php 我下载的是2.3.3,其实我也不清楚这些版本的区别...
这个安装包是专门给ubuntu16和ubuntu18时间同步ntp离线安装包。 使用方法: 1.下载后解压; 2.上传到ubuntu指定目录下; 3.直接运行命令安装; 4.可以参考我的博文设置。
本文实例讲述了Ubuntu环境编译安装PHP和Nginx的方法。分享给大家供大家参考,具体如下: 编译安装nginx 切换目录到工作文件夹: cd /usr/local/src 下载pcre源代码并安装 wget ftp://ftp.csx.cam.ac.uk/pub/...
NULL 博文链接:https://jzkangta.iteye.com/blog/987269
安装Nginx源码包可以在官方主页上下载。Ubuntu 9.04可以直接通过apt安装,也可以从这里下载最新的deb包:sudo apt-get install nginx如果要自己编译的话,需要确保自己已经有编译器和PCRE的库(用于Nginx的rewrite...
NULL 博文链接:https://ethanwooblog.iteye.com/blog/1340252
4、面板增加两种安装方式,极速安装与编译安装,极速方式最快可在几十秒内完成amh面板环境安装部署。 5、极速安装无最低硬件需求,可以在 128MB 以下的内存的机器安装。 6、面板增加授权与amh用户关联。 7、改进...
-LNMP 第一,在虚拟盒子上安装Ubuntu。 第二,在VBox下Ubuntu非源码构建LNMP 单纯通过apt-get安装PHP,MySQL,Nginx,并配置。
要使用njs,需要安装一个nginx,这里的我使用的环境是Ubuntu18.04.4。 首先从http://nginx.org/en/download.html下载最新的stable version的nginx源码。 a. 解压源码 sudo tar zxvf nginx-1.18.0.tar.gz b. 安装...
安装nginx,如果需要安装最新的nginx需从官网下载源码包进行手动编译。 nginx的大致文件结构。 1.配置文件:/etc/nginx 2.程序:/usr/sbin/nginx 3.日志:/var/log/nginx/access.log – error.log 第三步,安装uwsgi...
博文链接:https://swachian.iteye.com/blog/175033