当前位置:首页 » 编程软件 » ubuntu编译安装nginx

ubuntu编译安装nginx

发布时间: 2022-08-18 10:31:03

⑴ ubuntu nginx安装失败,求助

进入/usr/local 获取pcre编译安装包,在http://www.pcre.org/上可以获取当前最新的版本
pcre-8.38.tar.bz2 解压: tar -jxvf pcre-8.38.tar.bz2
进入解压缩目录,执行./configure。
遇到问题一:./configure: error: C compiler cc is not found
解决方案: sudo apt-get install -y gcc
遇到问题二:configure: error: You need a C++ compiler for C++ support.
解决方案:sudo apt-get install build-essential
再./configure

⑵ Ubuntu10.04下,nginx添加fastdfs-nginx-mole,编译后启动nginx,只看见master进程,为什么

回复 1# nicole0169 应该是fastdfs扩展模块没有编译进nginx。请参照INSTALL文件说明。另外,你的nginx版本比较老,建议升级到最新的stable版本。

⑶ 在Ubuntu 里有没有什么命令确定 Nginx 配置文件位置

当你执行 nginx -t
得时候,nginx会去测试你得配置文件得语法,并告诉你配置文件是否写得正确,同时也告诉了你配置文件得路径:
# nginx -t
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful

⑷ ubuntu怎么编译nginx

先解压nginx的tar包,进入解压后的文件夹里,如果要安装到其他路径的话,修改configure文件里的prefix的值然后执行./configure,或者直接使用./configure --prefix=/xx/xx/xxx来指定,安装路径然后make -j2,如果你的处理器核多,可以增大数字,再然后就是make & make install了。
要注意的是./configure后面可以跟随很多参数配置:
比如,需要的话可以加上--config-path=/xx/xx/xxx/nginx.conf指定nginx的服务器配置文件路径;
--add-mole增加模块,比如luz、pagespeed、upstream等等,这些都可以在官网上查到。

⑸ ubuntu 编译nginx的时候报错,如何解决

先解压nginx的tar包,进入解压后的文件夹里,如果要安装到其他路径的话,修改configure文件里的prefix的值然后执行./configure,或者直接使用./configure --prefix=/xx/xx/xxx来指定,安装路径然后make -j2,如果你的处理器核多,可以增大数字

⑹ nginx编译安装的时候nginx.lock是什么目录

假设你是用包管理工具安装的nginx: 如果你是redhat系列的,安装包是.rpm包,或者你用yum安装的话,这样查找: rpm -ql nginx 如果是ubuntu,也是类似的方法,具体参数你可以查查 如果你是源码安装的nginx 那么需要问问安装的人了

⑺ 编译安装nginx和yum安装nginx有什么区别

如果真的要说区别的话,源码编译安装可以在各个linux系统下使用,而yum安装只能在redhat或centos系统使用,其它系统例如ubuntu,freebsd是不可用的。另外yum安装的nginx版本偏低,而源码包是可以获取官方最新的发行版本的。

⑻ ubuntu 16.04下怎样安装nginx

2种方法:
1,apt-get install nginx
2,网上下载nginx安装包,然后编译

⑼ ubuntu怎么安装nginx

Nginx程序的稳定性来自于它采用了分阶段的资源分配技术,使得CPU与内存占用率会非常低,所以使用Nginx程序部署动态网站环境不仅十分的稳定、高效,而且消耗更少的系统资源,丰富的模块功能也几乎与Apache程序数量相同,现在已经完全的支持了proxy、rewrite、mod_fcgi、ssl、vhosts等常用模块。而且还支持了热部署技术,即能够可以7*24不间断提供服务,即便运行数月也无须重启,而且还可以在不暂停服务的情况下直接对Nginx服务程序进行升级。
坦白来讲,虽然Nginx程序的代码质量非常高,代码很规范,技术成熟,模块扩展也很容易,但Nginx依然存在不少问题,比如Nginx是由俄罗斯人创建的,所以在资料文档方面还并不完善,中文教材的质量更是鱼龙混杂,但Nginx近年来增长势头迅猛,预测未来应该能够在轻量级HTTP服务器市场有不错的未来。

安装PCRE(Perl兼容的正则表达式库,解压与编译过程已省略):
[root@linuxprobe ~]# cd /usr/local/src
[root@linuxprobe src]# mkdir /usr/local/pcre
[root@linuxprobe src]# tar xzvf pcre-8.35.tar.gz
[root@linuxprobe src]# cd pcre-8.35
[root@linuxprobe pcre-8.35]# ./configure --prefix=/usr/local/pcre
[root@linuxprobe pcre-8.35]# make
[root@linuxprobe pcre-8.35]# make install

安装openssl服务程序(解压与编译过程已省略):
[root@linuxprobe pcre-8.35]# cd /usr/local/src
[root@linuxprobe src]# mkdir /usr/local/openssl
[root@linuxprobe src]# tar xzvf openssl-1.0.1h.tar.gz
[root@linuxprobe src]# cd openssl-1.0.1h
[root@linuxprobe openssl-1.0.1h]# ./config --prefix=/usr/local/openssl
[root@linuxprobe openssl-1.0.1h]# make
[root@linuxprobe openssl-1.0.1h]# make install

把openssl服务程序命令目录添加到环境变量中(永久生效):
[root@linuxprobe pcre-8.35]# vim /etc/profile
//将配置文件最下面的参数追加参数为:
export PATH=$PATH:/usr/local/mysql/bin:/usr/local/openssl/bin
[root@linuxprobe pcre-8.35]# source /etc/profile

安装zlib数据压缩函数库(解压与编译过程已省略):
[root@linuxprobe pcre-8.35]# cd /usr/local/src
[root@linuxprobe src]# mkdir /usr/local/zlib
[root@linuxprobe src]# tar xzvf zlib-1.2.8.tar.gz
[root@linuxprobe src]# cd zlib-1.2.8
[root@linuxprobe zlib-1.2.8]# ./configure --prefix=/usr/local/zlib
[root@linuxprobe zlib-1.2.8]# make
[root@linuxprobe zlib-1.2.8]# make install

创建用于执行nginx服务的用户:
[root@linuxprobe zlib-1.2.8]# cd ..
[root@linuxprobe src]# useradd www -s /sbin/nologin

安装nginx服务程序(openssl,zlib,pcre要写成源码解压路径!!!):
[root@linuxprobe src]# tar xzvf nginx-1.6.0.tar.gz
[root@linuxprobe src]# cd nginx-1.6.0/
[root@linuxprobe nginx-1.6.0]# ./configure --prefix=/usr/local/nginx --without-http_memcached_mole --user=www --group=www --with-http_stub_status_mole --with-http_ssl_mole --with-http_gzip_static_mole --with-openssl=/usr/local/src/openssl-1.0.1h --with-zlib=/usr/local/src/zlib-1.2.8 --with-pcre=/usr/local/src/pcre-8.35
[root@linuxprobe nginx-1.6.0]# make
[root@linuxprobe nginx-1.6.0]# make install

创建nginx程序脚本(将下面的参数直接复制进去即可):
[root@linuxprobe nginx-1.6.0]# vim /etc/rc.d/init.d/nginx
#!/bin/bash
# nginx - this script starts and stops the nginx daemon
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /usr/local/nginx/logs/nginx.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
nginx="/usr/local/nginx/sbin/nginx"
prog=$(basename $nginx)
NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"
[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
lockfile=/var/lock/subsys/nginx
make_dirs() {
# make required directories
user=`$nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -`
if [ -z "`grep $user /etc/passwd`" ]; then
useradd -M -s /bin/nologin $user
fi
options=`$nginx -V 2>&1 | grep 'configure arguments:'`
for opt in $options; do
if [ `echo $opt | grep '.*-temp-path'` ]; then
value=`echo $opt | cut -d "=" -f 2`
if [ ! -d "$value" ]; then
# echo "creating" $value
mkdir -p $value && chown -R $user $value
fi
fi
done
}
start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
make_dirs
echo -n $"Starting $prog: "
daemon $nginx -c $NGINX_CONF_FILE
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
#configtest || return $?
stop
sleep 1
start
}
reload() {
#configtest || return $?
echo -n $"Reloading $prog: "
killproc $nginx -HUP
RETVAL=$?
echo
}
force_reload() {
restart
}
configtest() {
$nginx -t -c $NGINX_CONF_FILE
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
exit 2
esac
[root@linuxprobe nginx-1.6.0]# chmod 755 /etc/rc.d/init.d/nginx

重启nginx服务程序并添加到开机启动项:
[root@linuxprobe nginx-1.6.0]# /etc/rc.d/init.d/nginx restart
Restarting nginx (via systemctl): [ OK ]
[root@linuxprobe nginx-1.6.0]# chkconfig nginx on

此时可以通过访问IP来判断nginx服务是否顺利运行
我们一般通过部署Linux+Nginx+MYSQL+PHP这四种开源软件,搭建一个免费、高效、扩展性强、资源消耗低的LNMP动态网站架构。关于这块的安装使用你可以看下http://www.linuxprobe.com/chapter-20.html#2022_Nginx

热点内容
androidbug 发布:2025-02-06 23:31:56 浏览:49
php数字判断 发布:2025-02-06 23:17:40 浏览:40
优路教育服务器连接不上怎么回事 发布:2025-02-06 23:03:49 浏览:141
数据库加速 发布:2025-02-06 23:02:14 浏览:565
苹果ipodpro如何连接安卓手机 发布:2025-02-06 23:00:56 浏览:529
android格式化sd卡 发布:2025-02-06 23:00:50 浏览:982
郝斌数据库 发布:2025-02-06 22:44:57 浏览:182
全息存储器 发布:2025-02-06 22:43:51 浏览:117
游戏源码如何使用 发布:2025-02-06 22:43:40 浏览:716
表与数据库 发布:2025-02-06 22:42:47 浏览:440