小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

Ubuntu16.04.1 安裝Nginx - 雨~桐 - 博客園

 埃德溫會館 2018-01-09

Nginx ("engine x") 是一個高性能的 HTTP 和 反向代理 服務(wù)器,也是一個 IMAP/POP3/SMTP 代理服務(wù)器。 Nginx 是由 Igor Sysoev 為俄羅斯訪問量第二的 Rambler.ru 站點開發(fā)的,第一個公開版本0.1.0發(fā)布于2004年10月4日。其將源代碼以類BSD許可證的形式發(fā)布,因它的穩(wěn)定性、豐富的功能集、示例配置文件和低系統(tǒng)資源的消耗而聞名。
安裝Nginx依賴庫
安裝gcc g++的依賴庫
ubuntu平臺可以使用如下命令。
1
2
apt-get install build-essential
apt-get install libtool
centeros平臺可以使用如下命令。
1
2
3
4
5
6
centos平臺編譯環(huán)境使用如下指令
安裝make:
yum -y install gcc automake autoconf libtool make
 
安裝g++:
yum install gcc gcc-c++  
安裝 pcre依賴庫(http://www./
1
2
sudo apt-get update
sudo apt-get install libpcre3 libpcre3-dev
安裝 zlib依賴庫(http://www.
1
apt-get install zlib1g-dev
安裝 ssl依賴庫
1
apt-get install openssl
安裝Nginx(http://
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#下載最新版本:
wget http:///download/nginx-1.11.3.tar.gz
#解壓:
tar -zxvf nginx-1.11.3.tar.gz
#進(jìn)入解壓目錄:
cd nginx-1.11.3
#配置:
./configure --prefix=/usr/local/nginx 
#編輯nginx:
make
注意:這里可能會報錯,提示“pcre.h No such file or directory”,具體詳見:http:///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會自動加載默認(rèn)路徑的配置文件,可以通過 -h查看幫助命令。
#查看nginx進(jìn)程:
ps -ef|grep nginx
Nginx常用命令
啟動 Nginx
1
2
3
/usr/local/nginx/sbin/nginx
 
./sbin/nginx 
停止 Nginx
1
2
3
./sbin/nginx -s stop
 
./sbin/nginx -s quit
-s都是采用向 Nginx 發(fā)送信號的方式。
Nginx重新加載配置
1
./sbin/nginx -s reload
指定配置文件
1
./sbin/nginx -c /usr/local/nginx/conf/nginx.conf
-c表示configuration,指定配置文件
查看 Nginx 版本
有兩種可以查看 Nginx 的版本信息的參數(shù)。第一種如下:
1
2
3
./sbin/nginx -v
 
nginx: nginx version: nginx/1.0.0
另一種顯示的是詳細(xì)的版本信息:
1
2
3
4
5
poechant@ubuntu:/usr/local/nginx$ ./sbin/nginx -V
nginx: nginx version: nginx/1.0.0
nginx: built by gcc 4.3.3 (Ubuntu 4.3.3-5ubuntu4)
nginx: TLS SNI support enabled
nginx: configure arguments: --with-http_ssl_module --with-openssl=/home/luming/openssl-1.0.0d/
檢查配置文件是否正確
1
2
3
4
5
poechant@ubuntu:/usr/local/nginx$ ./sbin/nginx -t
nginx: [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 ok
2012/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
如果出現(xiàn)如上的提示信息,表示沒有訪問錯誤日志文件和進(jìn)程,可以sudo(super user do)一下:
1
2
3
poerchant@ubuntu:/usr/local/nginx$ sudo ./sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
如果顯示如上,則表示配置文件正確。否則,會有相關(guān)提示。
顯示幫助信息
1
poechant@ubuntu:/user/local/nginx$ ./sbin/nginx -h
或者:
1
poechant@ubuntu:/user/local/nginx$ ./sbin/nginx -?

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多