今天學習 Nginx ,在這裏記下筆記
參考此篇安裝win7 下 VirtualBox 虛擬機安裝 CentOS 系統,並設置網絡與SSH
https://blog.csdn.net/matthewwu/article/details/87194855
使用 vim 代替 vi
https://blog.csdn.net/qinglu000/article/details/8732217
Centos 下載:
http://isoredirect.centos.org/centos/7/isos/x86_64/
虛擬機網絡配置看這裏,可以方便在本機測試。
https://www.cnblogs.com/jxldjsn/p/10654336.html
Nginx 下載:
http://nginx.org/en/download.html
#安裝 wget 和 vim
yum -y install wget vim
#下載 nginx
wget http://nginx.org/download/nginx-1.16.1.tar.gz
tar -xzf nginx-1.16.1.tar.gz
Ngixn 版本說明:
Mainline version:Mainline 是 Nginx 目前主力在做的版本,可以說是開發版
Stable version:最新穩定版,生產環境上建議使用的版本
Legacy versions:遺留的老版本的穩定版
Nginx 配置文件下 vim 的高亮顯示:
https://blog.csdn.net/liuxl57805678/article/details/88358500
Centos 7 重啓網絡:
重新啓動網絡:
systemctl start network.service
或者
service network restart
安裝 ngixn 所需依賴:
yum -y install gcc gcc-c++ autoconf automake make pcre-devel openssl openssl-devel
執行安裝:
./configure --prefix=/usr/local/nginx
nginx 安裝成功:
然後進行編譯:
make
make install
默認訪問 IP 地址是無法訪問的,需要關閉防火牆,或者打開 80 端口,我採用關閉防火牆方式。
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall開機啓動