Nginx Linux詳細安裝部署教程

2021-09-12 20:18:49 字數 2740 閱讀 7060

nginx是乙個web伺服器也可以用來做負載均衡及反向**使用,目前使用最多的就是負載均衡,下面介紹安裝步驟

[root@localhost src]# wget 

[root@localhost src]# wget

[root@localhost src]# wget

[root@localhost src]# wget

安裝c++編譯環境,如已安裝可略過

[root@localhost src]# yum install gcc-c++

期間會有確認提示輸入y回車

is this ok [y/n]:y

2、安裝nginx及相關元件

openssl安裝

[root@localhost src]# tar zxvf openssl-fips-2.0.10.tar.gz

[root@localhost src]# cd openssl-fips-2.0.10

[root@localhost openssl-fips-2.0.10]# ./config && make && make install

pcre安裝

[root@localhost src]# tar zxvf pcre-8.40.tar.gz

[root@localhost src]# cd pcre-8.40

[root@localhost pcre-8.40]# ./configure && make && make install

zlib安裝

[root@localhost src]# tar zxvf zlib-1.2.11.tar.gz

[root@localhost src]# cd zlib-1.2.11

[root@localhost zlib-1.2.11]# ./configure && make && make install

nginx安裝

[root@localhost src]# tar zxvf nginx-1.10.2.tar.gz

[root@localhost src]# cd nginx-1.10.2

[root@localhost nginx-1.10.2]# ./configure && make && make install

3、啟動nginx

先找一下nginx安裝到什麼位置上了

[root@centos6 package]# find / -name nginx

/home/package/nginx-1.10.2/objs/nginx

/usr/local/nginx

/usr/local/nginx/sbin/nginx

執行命令會啟動nginx

/usr/local/nginx/sbin/nginx
報錯了,error while loading shared libraries: libpcre.so.1: cannot open shared object file: no such file or directory,按照下面方式解決

1.用whereis libpcre.so.1命令找到libpcre.so.1在**

2.用ln -s /usr/local/lib/libpcre.so.1 /lib64命令做個軟連線就可以了

3.用sbin/nginx啟動nginx

4.用ps -aux | grep nginx檢視狀態

[root@localhost nginx]# whereis libpcre.so.1

[root@localhost nginx]# ln -s /usr/local/lib/libpcre.so.1 /lib64

[root@localhost nginx]# sbin/nginx

[root@localhost nginx]# ps -aux | grep nginx

進入linux系統的圖形介面,開啟瀏覽器輸入localhost會看到下圖,說明nginx啟動成功

nginx的基本操作

啟動

[root@localhost ~]# /usr/local/nginx/sbin/nginx

停止/重啟

[root@localhost ~]# /usr/local/nginx/sbin/nginx -s stop(quit、reload)

命令幫助

[root@localhost ~]# /usr/local/nginx/sbin/nginx -h

驗證配置檔案

[root@localhost ~]# /usr/local/nginx/sbin/nginx -t

配置檔案

[root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf

4、簡單配置nginx

開啟nginx配置檔案位於nginx目錄下的conf資料夾下

/usr/local/nginx/conf/nginx.conf

Nginx Linux詳細安裝部署教程

nginx engine x 是乙個高效能的 http和反向 伺服器,也是乙個imap pop3 smtp 伺服器。正向 反向 1 http伺服器,可以做靜態網頁的http伺服器。2 配置虛擬機器。乙個網域名稱可以被多個ip繫結。可以根據網域名稱的不同吧請求 給執行在不同埠的伺服器。3 反向 負載均...

Nginx Linux安裝詳解

nginx是乙個web伺服器,可以用於負載均衡和反向 的乙個工具 安裝c 編譯環境 root localhost src yum install gcc c 第二步 解壓安裝對應的軟體 一 openssl安裝 解壓 root localhost tar zxvf openssl fips 2.0.1...

nginx linux 安裝 啟動 公升級

nginx linux 安裝 啟動 公升級 2 解壓,執行configure指令碼 tar zxvf nginx 1.10.3.tar.gz cd nginx 1.10.3 configure make sudo make install3 若執行config報錯,很有可能是環境依賴的問題,執行如下...