一、安裝和部署
1、依賴包的安裝
(1)GCC 全家桶
sudo apt install git build-essential
包含的軟件如下:
依賴: libc6-dev
依賴: <libc-dev>
libc6-dev
依賴: gcc
依賴: g++
依賴: make
make-guile
依賴: dpkg-dev
(2)openssl:用於網站加密通訊。
sudo apt install openssl libssl-dev
(3)pcre(Perl Compatible Regular Expressions):用於支持解析正則表達式。
sudo apt install libpcre3 libpcre3-dev
(4)zlib:用於對數據進行解壓縮。網站之間通信時,數據先壓縮(格式:gzip)再傳輸,通過消耗 CPU 的方式來節省網絡帶寬。
sudo apt install zlib1g-dev
2、nginx的安裝和配置
./configure
--sbin-path=/usr/local/nginx/nginx (可執行文件)
--conf-path=/usr/local/nginx/nginx.conf (配置文件)
--pid-path=/usr/local/nginx/nginx.pid (存放 nginx 主進程 PID)
--with-http_ssl_module (向 nginx 中添加模塊:http_ssl_module)
--with-http_stub_status_module (向 nginx 中添加模塊:http_ssl_module)
--with-stream (向 nginx 中添加模塊:stream)
make
make install
三、啓動
cd /usr/local/nginx/
sudo ./nginx
執行命令
ps -eo pid,ppid,sid,tty,pgrp,comm,stat,cmd | grep -E 'bash|PID|nginx'
結果如下
PID PPID SID TT PGRP COMMAND STAT CMD
1749 1741 1749 pts/0 1749 bash Ss bash
12919 1267 12919 ? 12919 nginx Ss nginx: master process ./nginx
12920 12919 12919 ? 12919 nginx S nginx: worker process
(SAW:Game Over!)