Nginx 下載和安裝

環境

系統環境:CentOS 7.7
Nginx:nginx/1.17.9

1.Nginx 簡介

Nginx 是一個高性能的 HTTP 和反向代理 Web 服務器,同時也提供了 IMAP/POP3/SMTP 服務。nginx

Nginx 是由伊戈爾·賽索耶夫爲俄羅斯訪問量第二的 Rambler.ru 站點開發的,,因它的穩定性、豐富的功能集、示例配置文件和低系統資源的消耗而聞名。bash

Nginx 是一款輕量級的 Web 服務器/反向代理服務器及電子郵件(IMAP/POP3)代理服務器,在 BSD-like 協議下發行。其特色是佔有內存少,併發能力強,事實上 Nginx 的併發能力在同類型的網頁服務器中表現較好,中國大陸使用 Nginx 網站用戶有:百度、京東、新浪、網易、騰訊、淘寶等。服務器

2.下載

官網下載,使用世界五百強科技企業【百度】搜索引擎搜 Nginx,目前選擇最新版本 nginx-1.17.9.tar.gz
步驟以下:
在這裏插入圖片描述
在這裏插入圖片描述
在這裏插入圖片描述併發

3.安裝

3.1.安裝依賴

[root@localhost ]# yum -y install gcc pcre-devel zlib-devel openssl openssl-devel

3.2.上傳並解壓

能夠經過工具 Winscp,把下載好的 nginx-1.17.9.tar.gz 上傳到服務器跟目錄,再解壓tcp

[root@localhost /]# tar -zxvf nginx-1.17.9.tar.gz

3.3.編譯安裝

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

默認安裝位置在 :分佈式

[root@localhost nginx]# pwd
/usr/local/nginx

服務啓動:工具

[root@localhost nginx]# /usr/local/nginx/sbin/nginx 
[root@localhost nginx]# ps -ef | grep nginx
root      39801      1  0 15:20 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
nobody    39802  39801  0 15:20 ?        00:00:00 nginx: worker process
root      39804  37153  0 15:20 pts/0    00:00:00 grep --color=auto nginx

如今已經起來了,可是 Linux 防火牆默認大部分端口是沒開放的,如今須要放開,Nginx 端口 80(默認)性能

#查看防火牆狀態
[root@localhost nginx]# firewall-cmd --state
running
#放開 80 端口,(--permanent永久生效,沒有此參數重啓後失效)
[root@localhost nginx]# firewall-cmd --zone=public --add-port=80/tcp --permanent
success
#從新加載防火牆信息
[root@localhost nginx]# firewall-cmd --reload
success

出現下圖說明 Nginx 服務安裝成功
在這裏插入圖片描述
### 3.4 Nginx 經常使用命令網站

[root@localhost sbin]# pwd
/usr/local/nginx/sbin
#查看 Nginx 版本
[root@localhost sbin]# ./nginx -V
nginx version: nginx/1.17.9
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) 
configure arguments:
#關閉 Nginx 
[root@localhost sbin]# ./nginx -s stop
#開啓 Nginx 
[root@localhost sbin]# ./nginx
#從新加載 Nginx 配置
[root@localhost sbin]# ./nginx -s reload
# Nginx 配置文件
[root@localhost sbin]# vi /usr/local/nginx/conf/nginx.conf

更多的配置在 nginx.conf 中修改,Nginx 還能夠和 FastDFS 作分佈式文件系統部署,更多的功能繼續嘗試中......ui

若是有哪些不對的地方煩請指認,先行感謝
相關文章
相關標籤/搜索