Ubuntu下安装nginx的步骤分享
sudo wget http://nginx.org/download/nginx-1.2.2.tar.gz
2)、解压
sudo tar -xzvf nginx-1.2.2.tar.gz
3)、进入相关目录进行以下操作
复制代码代码如下:
./configure
make
sudo make install
如果你运气好的话,一切ok,不过...........哈哈。Ubuntu默认的策略是什么库都不装,依赖的库都需要自已手工安装搞定。 一般都会出错的,那么我们来看看可能出现的问题。
4)、常见问题解决办法
缺少pcre library
./configure: error: the HTTP rewrite module requires the PCRE library. You can either disable the module by using --without-http_rewrite_module option, or install the PCRE library into the system, or build the PCRE library statically from the source with nginx by using --with-pcre=<path> option.
解决方法:下载安装pcre-8.31解决问题,解压后对pcre进行如下操作
复制代码代码如下:
sudo wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.31.tar.gz
sudo tar -xzvf pcre-8.31.tar.gz
cd /usr/local/src/pcre-8.31
./configure
make
sudo make install
运气好一次通过,运气不好,make pcre时会出错
缺少gcc-c++和libtool,也就是c++编译包
复制代码代码如下:
libtool: compile: unrecognized option `-DHAVE_CONFIG_H'
libtool: compile: Try `libtool --help' for more information.
make[1]: *** [pcrecpp.lo] Error 1
make[1]: Leaving directory `/usr/local/src//pcre-8.31'
make: *** [all] Error 2root@wolfdog-virtual-machine:~/work/pcre-8.12$ libtool -help -DHAVE_CONFIG_H
The program 'libtool' is currently not installed. You can install it by typing:
sudo apt-get install libtool
解决方法:需要先安装libtool和gcc-c++
?sudo apt-get install libtool
sudo apt-get install gcc-c++
大爷啊~~~这时候可能又会报错啊,坑爹啊~~~
缺少openssl库
复制代码代码如下:
./configure: error: the HTTP cache module requires md5 functions
from OpenSSL library. You can either disable the module by using
--without-http-cache option, or install the OpenSSL library into the system,
or build the OpenSSL library statically from the source with nginx by using
--with-http_ssl_module --with-openssl=<path> options.
缺少zlib库
复制代码代码如下:
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.
解决办法:少什么就安装什么呗。
sudo apt-get install openssl libssl-dev libperl-dev
4)、解决了以上问题,编译nginx就没啥问题了。下面安装。(附加安装插件的方法)
先下载插件并解压
复制代码代码如下:
sudo wget https://github.com/agentzh/echo-nginx-module/tarball/v0.40rc1 -O echo-nginx-module.tar.gz
sudo wget https://nodeload.github.com/agentzh/memc-nginx-module/tarball/v0.13rc3 -O memc-nginx-module.tar.gz
sudo tar -xzvf echo-nginx-module.tar.gz
sudo tar -xzvf memc-nginx-module.tar.gz
进入nginx目录cd nginx-1.2.2/,执行以下命令
复制代码代码如下:
./configure --user=www-data --group=www-data --with-debug --with-http_gzip_static_module --with-http_ssl_module --with-pcre=../pcre-8.31/ --with-http_perl_module --with-perl=/usr/bin/perl --with-http_stub_status_module --with-http_realip_module \
--prefix=/usr/local/nginx \
--add-module=../agentzh-echo-nginx-module-9259898/ \
--add-module=../agentzh-memc-nginx-module-4007350/ \
注:前面一段是一些编译参数,后面add-module是添加模块
make -j2
make install
大爷的,又可能报错。没有nginx,logs目录访问权限
复制代码代码如下:
[alert]: could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (13: Permission denied)
2011/03/21 06:09:33 [emerg] 24855#0: mkdir() "/usr/local/nginx/client_body_temp" failed (13: Permission denied)
解决办法:
复制代码代码如下:
sudo chmod a+rwx -R logs
sudo chmod a+rwx -R /usr/local/nginx
现在,差不多没问题了。
可以进入/usr/local/nginx/sbin/执行以下命令看是否成功:
nginx -v
5)、nginx自启动
编辑启动脚本:
复制代码代码如下:
sudo vim /etc/init.d/nginx
复制代码代码如下:
#! /bin/bash
#
# nginx Start up the nginx server daemon
#
# chkconfig: 2345 55 25
# Description: starts and stops the nginx web server
#
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: starts and stops the nginx web server
### END INIT INFO
# To install:
# copy this file to /etc/init.d/nginx
# shell> chkconfig --add nginx (RedHat)
# shell> update-rc.d -f nginx defaults (debian)
# To uninstall:
# shell> chkconfig --del nginx (RedHat)
# shell> update-rc.d -f nginx remove
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
NAME=nginx
DAEMON=/usr/local/nginx/sbin/$NAME
CONFIGFILE=/usr/local/nginx/conf/$NAME.conf
PIDFILE=/var/local/nginx/logs/$NAME.pid
ULIMIT=10240
set -e
[ -x "$DAEMON" ] || exit 0
do_start() {
echo "Starting $NAME ..."
ulimit -SHn $ULIMIT
$DAEMON -c $CONFIGFILE
}
do_stop() {
echo "Shutting down $NAME ..."
kill 'cat $PIDFILE'
}
do_reload() {
echo "Reloading $NAME ..."
kill -HUP 'cat $PIDFILE'
}
case "$1" in
start)
[ ! -f "$PIDFILE" ] && do_start || echo "nginx already running"
echo -e ".done"
;;
stop)
[ -f "$PIDFILE" ] && do_stop || echo "nginx not running"
echo -e ".done"
;;
restart)
[ -f "$PIDFILE" ] && do_stop || echo "nginx not running"
do_start
echo -e ".done"
;;
reload)
[ -f "$PIDFILE" ] && do_reload || echo "nginx not running"
echo -e ".done"
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|reload}" >&2
exit 1
;;
esac
exit 0
红色部分,根据自己的路径修改。
6)、常用命令
重启nginx:service nginx restart
启动:service nginx start
关闭:service nginx stop
7)、linux常用命令
tar(z-用 gzip 对存档压缩或解压;x-从存档展开文件;v-详细显示处理的文件;f-指定存档或设备)
tar –zxvf nginx-0.8.54.tar.gz
ip查看
ifconfig
编译
make
安装编译好的源码包
make install
编辑文件
sudo gedit /etc/profile
修改根限:chmod说明(u:与文件属主拥有一样的权限[a:所有人];+:增加权限;rwx:可读可写可执行)
-R:递归所有目录和文件
sudo chmod a+rwx -R logs
检查是库是否安装成功
dpkg --list|grep openssl
下载安装库
sudo apt-get install libtool
检查服务启动是否正常
ps -ef|grep
查找openssl安装路径
whereis openssl
更新源
sudo apt-get update
更新已安装的包
sudo apt-get upgrade
推荐系统
电脑公司Ghost Win8.1 x32 精选纯净版2022年7月(免激活) ISO镜像高速下载
语言:中文版系统大小:2.98GB系统类型:Win8电脑公司Ghost Win8.1x32位纯净版V2022年7月版本集成了自2022流行的各种硬件驱动,首次进入系统即全部硬件已安装完毕。电脑公司Ghost Win8.1x32位纯净版具有更安全、更稳定、更人性化等特点。集成最常用的装机软件,精心挑选的系统维护工具,加上绿茶独有
微软Win11原版22H2下载_Win11GHOST 免 激活密钥 22H2正式版64位免费下载
语言:中文版系统大小:5.13GB系统类型:Win11微软Win11原版22H2下载_Win11GHOST 免 激活密钥 22H2正式版64位免费下载系统在家用办公上跑分表现都是非常优秀,完美的兼容各种硬件和软件,运行环境安全可靠稳定。Win11 64位 Office办公版(免费)优化 1、保留 Edge浏览器。 2、隐藏“操作中心”托盘图标。 3、保留常用组件(微软商店,计算器,图片查看器等)。 5、关闭天气资讯。
Win11 21H2 官方正式版下载_Win11 21H2最新系统免激活下载
语言:中文版系统大小:4.75GB系统类型:Win11Ghost Win11 21H2是微软在系统方面技术积累雄厚深耕多年,Ghost Win11 21H2系统在家用办公上跑分表现都是非常优秀,完美的兼容各种硬件和软件,运行环境安全可靠稳定。Ghost Win11 21H2是微软最新发布的KB5019961补丁升级而来的最新版的21H2系统,以Windows 11 21H2 22000 1219 专业版为基础进行优化,保持原汁原味,系统流畅稳定,保留常用组件
windows11中文版镜像 微软win11正式版简体中文GHOST ISO镜像64位系统下载
语言:中文版系统大小:5.31GB系统类型:Win11windows11中文版镜像 微软win11正式版简体中文GHOST ISO镜像64位系统下载,微软win11发布快大半年了,其中做了很多次补丁和修复一些BUG,比之前的版本有一些功能上的调整,目前已经升级到最新版本的镜像系统,并且优化了自动激活,永久使用。windows11中文版镜像国内镜像下载地址微软windows11正式版镜像 介绍:1、对函数算法进行了一定程度的简化和优化
微软windows11正式版GHOST ISO镜像 win11下载 国内最新版渠道下载
语言:中文版系统大小:5.31GB系统类型:Win11微软windows11正式版GHOST ISO镜像 win11下载 国内最新版渠道下载,微软2022年正式推出了win11系统,很多人迫不及待的要体验,本站提供了最新版的微软Windows11正式版系统下载,微软windows11正式版镜像 是一款功能超级强大的装机系统,是微软方面全新推出的装机系统,这款系统可以通过pe直接的完成安装,对此系统感兴趣,想要使用的用户们就快来下载
微软windows11系统下载 微软原版 Ghost win11 X64 正式版ISO镜像文件
语言:中文版系统大小:0MB系统类型:Win11微软Ghost win11 正式版镜像文件是一款由微软方面推出的优秀全新装机系统,这款系统的新功能非常多,用户们能够在这里体验到最富有人性化的设计等,且全新的柔软界面,看起来非常的舒服~微软Ghost win11 正式版镜像文件介绍:1、与各种硬件设备兼容。 更好地完成用户安装并有效地使用。2、稳定使用蓝屏,系统不再兼容,更能享受无缝的系统服务。3、为
雨林木风Windows11专业版 Ghost Win11官方正式版 (22H2) 系统下载
语言:中文版系统大小:4.75GB系统类型:雨林木风Windows11专业版 Ghost Win11官方正式版 (22H2) 系统下载在系统方面技术积累雄厚深耕多年,打造了国内重装系统行业的雨林木风品牌,其系统口碑得到许多人认可,积累了广大的用户群体,雨林木风是一款稳定流畅的系统,一直以来都以用户为中心,是由雨林木风团队推出的Windows11国内镜像版,基于国内用户的习惯,做了系统性能的优化,采用了新的系统
雨林木风win7旗舰版系统下载 win7 32位旗舰版 GHOST 免激活镜像ISO
语言:中文版系统大小:5.91GB系统类型:Win7雨林木风win7旗舰版系统下载 win7 32位旗舰版 GHOST 免激活镜像ISO在系统方面技术积累雄厚深耕多年,加固了系统安全策略,雨林木风win7旗舰版系统在家用办公上跑分表现都是非常优秀,完美的兼容各种硬件和软件,运行环境安全可靠稳定。win7 32位旗舰装机版 v2019 05能够帮助用户们进行系统的一键安装、快速装机等,系统中的内容全面,能够为广大用户
相关文章
- UEFI怎么装Win7系统?uefi安装win7系统图解
- thinkpad电脑安装win10系统图文教程
- FreeBSD 软件安装
- win8.1系统玩dota游戏非常卡的3种原因分析及解决方法
- Win7 32位系统下手动修改磁盘属性例如M盘修改为F盘
- Windows系统任务栏总是假死该怎么办?
- gnu bash shell编程之bash编程常用语法、特殊变量整理到一张图片上
- 什么是虚拟网络 虚拟网络得以保留的原因
- win7系统屏幕出现brightness字样还不断闪出1024768字样的故障原因及解决方法
- Win10 build 10125 新版Jump Lists设计出炉
- 如何一键重装win10系统?桔子一键重装win10系统教程
- 微软印尼总裁官方确认:Win8用户将可免费升级Win9
- win10系统xlive.dll没有被指定在windows运行怎么办
- Win10移动版周年更新14322快速通道更新 加入了全新内容
- MAC怎么切换输入法 切换输入法的按键是什么
- Win10 Mobile红石版VLC播放器5月发布 测试版下周公测
- Win10正式版年度更新全部免费升级 7月29日起收费
- Linux系统下基本的帮助查询命令小结
热门系统
- 1华硕笔记本&台式机专用系统 GhostWin7 32位正式旗舰版2018年8月(32位)ISO镜像下载
- 2深度技术 Windows 10 x86 企业版 电脑城装机版2018年10月(32位) ISO镜像免费下载
- 3电脑公司 装机专用系统Windows10 x86喜迎国庆 企业版2020年10月(32位) ISO镜像快速下载
- 4雨林木风 Ghost Win7 SP1 装机版 2020年4月(32位) 提供下载
- 5深度技术 Windows 10 x86 企业版 六一节 电脑城装机版 版本1903 2022年6月(32位) ISO镜像免费下载
- 6深度技术 Windows 10 x64 企业版 电脑城装机版2021年1月(64位) 高速下载
- 7新萝卜家园电脑城专用系统 Windows10 x64 企业版2019年10月(64位) ISO镜像免费下载
- 8新萝卜家园 GhostWin7 SP1 最新电脑城极速装机版2018年8月(32位)ISO镜像下载
- 9电脑公司Ghost Win8.1 x32 精选纯净版2022年5月(免激活) ISO镜像高速下载
- 10新萝卜家园Ghost Win8.1 X32 最新纯净版2018年05(自动激活) ISO镜像免费下载
热门文章
常用系统
- 1Win10系统正版下载_大地系统 Ghost Win10 64位专业版免费下载
- 2Win11精简版下载_Win11 64位精简版游戏优化系统2023.03
- 3绿茶系统 Ghost Win7一键安装版下载_正版Win7 64位旗舰版免费激活版下载
- 4技术员联盟 GHOST WIN7 SP1 X86 游戏体验版 V2023.01 (32位) 下载
- 5番茄花园Win10 x86(1903专业版)v2023.10最新下载
- 6电脑公司Ghost Win10 X64位 极速专业版v2023.11最新下载
- 7笔记本系统Ghost Win8.1 (32位) 极速纯净版2020年3月(免激活) ISO镜像高速下载
- 8雨林木风 Ghost Win7 64位 极速装机版 v2023.03最新免费下载
- 9笔记本&台式机专用系统 Windows10 企业版 2020年8月(32位) ISO镜像快速下载
- 10Win7 64位旗舰版下载_笔记本专用 Ghost Win7 64位 极速装机版下载V2023.01