在OpenSUSE下編譯安裝Nginx

2021-09-19 10:04:36 字數 3252 閱讀 2034

在nginx官網上選擇穩定的版本nginx。解壓到/usr/local/src/目錄。

筆者使用的是nginx-1.9.9。

進入/usr/local/src繼續操作)

安裝:

.configure

make && make install

高版本會出現no rule to make target 'libpcre.la錯誤,建議選擇版本低一些,因為nginx暫不支援,可以使用8.37版本。

編譯錯誤:'aclocal-1.14' is missing on your system.

解決:輸入命令touch configure.ac aclocal.m4 configure makefile.am makefile.in,然後重新編譯。

安裝:

.configure

make && make install

解壓即可

--prefix=path: 指定nginx的安裝目錄。預設/usr/local/nginx

--conf-path=path: 設定nginx.conf配置檔案的路徑。nginx允許通過命令列中的-c選項使用不同的配置檔案啟動。預設為prefix/conf/nginx.conf

--with-pcre: 設定pcre庫的原始碼路徑

--with-zlib=path: 指定 zlib的安裝目錄。

--with-http_ssl_module: 使用https協議模組。預設情況下,該模組沒有被構建。前提是openssl與openssl-devel已安裝

--with-openssl:openssl解壓目錄

--pid-path:nginx執行時的程序id儲存目錄

make && make install
通過命令/usr/local/nginx/nginx執行nginx

在命令列下輸入netstat -ptnl | grep 'nginx'檢視nginx是否啟動成功

開啟瀏覽器,輸入localhost,如果看到下面的welcome nginx頁面說明安裝成功了

安裝完成後,如果需要在命令列下啟動和停止nginx,或者新增開機啟動任務,需要新增指令碼到/etc/init.d/目錄。

#! /bin/sh

# description: startup script for nginx on centos、suse、redhat. cp it in /etc/init.d and

# chkconfig --add nginx && chkconfig nginx on

# then you can use server command control nginx

## chkconfig: 2345 08 99

# description: starts, stops nginx

set -e

path=$path:/usr/local/nginx/sbin/

desc="nginx daemon"

name=nginx

daemon=/usr/local/nginx/sbin/$name

configfile=/usr/local/nginx/conf/nginx.conf

pidfile=/usr/local/nginx/logs/$name.pid

scriptname=/etc/init.d/$name

# gracefully exit if the package has been removed.

test -x $daemon || exit 0

d_start()

d_stop()

d_reload()

case "$1" in

start)

echo -n "starting $desc: $name"

d_start

echo "."

;;stop)

echo -n "stopping $desc: $name"

d_stop

echo "."

;;reload)

echo -n "reloading $desc configuration..."

d_reload

echo "reloaded."

;;restart)

echo -n "restarting $desc: $name"

d_stop

sleep 1

d_start

echo "."

;;*)

echo "usage: $scriptname " >&2

exit 3

;;esac

exit 0

使用方法:

vim /etc/init.d/nginx

chmod +x /etc/init.d/nginx

chkconfig nginx on

chkconfig --level 2345 nginx on

啟動方法:

service nginx ***

/etc/init.d/nginx ***

mysql 在opensuse 上安裝

1.1 zypper search mysql 1.2 zypper install mysql community server 預設目錄 可執行檔案目錄 usr bin mysql 配置檔案目錄 etc mysql 資料存放目錄 var lib mysql 配置檔案目錄 usr share my...

在opensuse安裝collaboa記

乙個用ror寫的版本管理與bug跟蹤系統。1 安裝svn,opensuse自帶的了svn。2 安裝swig,swig是乙個介面編譯器,用來 連線c c 和 perl pyhon ruby 等.google了一下沒有找到opensuse對應的 測試一下.irb irb main 001 0 requi...

ACE在Linux下編譯安裝

ace版本 ace 5.6 安裝過程 設定環境變數 看使用者使用的是那種shell環境,我比較喜歡用csh的所以在.cshrc檔案中新增ace root環境變數 bash的在.bashrc裡配置 export mpc root ace root mpc export ld library path ...