當前位置:首頁 » 編程軟體 » 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

熱點內容
銀行密碼泄露應該辦理什麼手續 發布:2024-03-29 05:01:40 瀏覽:522
sql插入二進制 發布:2024-03-29 05:00:32 瀏覽:22
安卓外部資源怎麼下載 發布:2024-03-29 04:01:17 瀏覽:245
華為被加密碼的相冊在哪裡查看 發布:2024-03-29 04:00:27 瀏覽:748
自動欣悅版有哪些配置 發布:2024-03-29 03:48:26 瀏覽:287
如何用腳本搶 發布:2024-03-29 03:01:59 瀏覽:120
火影忍者手游配置怎麼調 發布:2024-03-29 02:53:53 瀏覽:103
編程畫櫻花 發布:2024-03-29 02:11:24 瀏覽:473
騰訊雲伺服器1mb老掉線 發布:2024-03-29 01:56:11 瀏覽:215
執行sql語句的存儲過程 發布:2024-03-29 01:52:37 瀏覽:697