国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > Nginx > 正文

Ubuntu16.04.1 安裝Nginx的方法

2024-08-30 12:28:28
字體:
來源:轉載
供稿:網友

Nginx ("engine x") 是一個高性能的 HTTP 和 反向代理 服務器,也是一個 IMAP/POP3/SMTP 代理服務器。 Nginx 是由 Igor Sysoev 為俄羅斯訪問量第二的 Rambler.ru 站點開發的,第一個公開版本0.1.0發布于2004年10月4日。其將源代碼以類BSD許可證的形式發布,因它的穩定性、豐富的功能集、示例配置文件和低系統資源的消耗而聞名。

安裝Nginx依賴庫

安裝gcc g++的依賴庫

ubuntu平臺可以使用如下命令。

apt-get install build-essentialapt-get install libtool 

centeros平臺可以使用如下命令。

centos平臺編譯環境使用如下指令

安裝make:

yum -y install gcc automake autoconf libtool make

安裝g++:

yum install gcc gcc-c++   

安裝 pcre依賴庫(http://www.pcre.org/)

sudo apt-get update sudo apt-get install libpcre3 libpcre3-dev 

安裝 zlib依賴庫(http://www.zlib.net)

apt-get install zlib1g-dev 

安裝 ssl依賴庫

apt-get install openssl 

安裝Nginx(http://nginx.org)

#下載最新版本:wget http://nginx.org/download/nginx-1.11.3.tar.gz#解壓:tar -zxvf nginx-1.11.3.tar.gz#進入解壓目錄:cd nginx-1.11.3#配置:./configure --prefix=/usr/local/nginx #編輯nginx:make注意:這里可能會報錯,提示“pcre.h No such file or directory”,具體詳見:http://stackoverflow.com/questions/22555561/error-building-fatal-error-pcre-h-no-such-file-or-directory 需要安裝 libpcre3-dev,命令為:sudo apt-get install libpcre3-dev#安裝nginx:sudo make install#啟動nginx:sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 注意:-c 指定配置文件的路徑,不加的話,nginx會自動加載默認路徑的配置文件,可以通過 -h查看幫助命令。#查看nginx進程:ps -ef|grep nginx 

Nginx常用命令

啟動 Nginx

/usr/local/nginx/sbin/nginx./sbin/nginx  

停止 Nginx

./sbin/nginx -s stop./sbin/nginx -s quit 

-s都是采用向 Nginx 發送信號的方式。

Nginx重新加載配置

./sbin/nginx -s reload 

指定配置文件

./sbin/nginx -c /usr/local/nginx/conf/nginx.conf 

-c表示configuration,指定配置文件

查看 Nginx 版本

有兩種可以查看 Nginx 的版本信息的參數。第一種如下:

./sbin/nginx -v nginx: nginx version: nginx/1.0.0 

另一種顯示的是詳細的版本信息:

poechant@ubuntu:/usr/local/nginx$ ./sbin/nginx -Vnginx: nginx version: nginx/1.0.0nginx: built by gcc 4.3.3 (Ubuntu 4.3.3-5ubuntu4)nginx: TLS SNI support enablednginx: configure arguments: --with-http_ssl_module --with-openssl=/home/luming/openssl-1.0.0d/ 

檢查配置文件是否正確

poechant@ubuntu:/usr/local/nginx$ ./sbin/nginx -tnginx: [alert] could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (13: Permission denied)nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok2012/01/09 16:45:09 [emerg] 23898#0: open() "/usr/local/nginx/logs/nginx.pid" failed (13: Permission denied)nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed 

如果出現如上的提示信息,表示沒有訪問錯誤日志文件和進程,可以sudo(super user do)一下:

poerchant@ubuntu:/usr/local/nginx$ sudo ./sbin/nginx -tnginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is oknginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful 

如果顯示如上,則表示配置文件正確。否則,會有相關提示。

顯示幫助信息

poechant@ubuntu:/user/local/nginx$ ./sbin/nginx -h 

或者:

poechant@ubuntu:/user/local/nginx$ ./sbin/nginx -? 

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持VEVB武林網。


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 台湾省| 黄陵县| 衡东县| 政和县| 泰顺县| 江孜县| 洪雅县| 涟源市| 黎城县| 临西县| 通化市| 安乡县| 迁西县| 铜山县| 晋城| 水富县| 沁源县| 汝阳县| 津市市| 合阳县| 林甸县| 肇庆市| 霍邱县| 驻马店市| 增城市| 枞阳县| 英吉沙县| 玉树县| 怀仁县| 浪卡子县| 安顺市| 金沙县| 旅游| 溆浦县| 柳州市| 合水县| 贵定县| 凌云县| 惠来县| 张北县| 许昌市|