1、安裝依賴
yum -y install gcc openssl-devel pcre-devel zlib-devel
2、解壓文件
tar -zxvf nginx-1.8.1.tar.gz
3、configure配置
進入解壓后的源碼目錄,然后執行configure命令進行配置。此時在/usr/soft/目錄下可以看到生成的nginx目錄。安裝好后,會在/usr/soft下生成nginx目錄(這是我編譯前指定的),這個目錄就是nginx的軟件了。
[root@asus soft]# ./nginx-1.8.1/configure --prefix=/usr/soft/nginx
[root@asus /]# cd /usr/soft/nginx
[root@asus nginx]# ll
4、編譯並安裝
[root@asus nginx]# make && make install
5、啟動命令
[root@asus nginx]# ./sbin/nginx
6、關閉防火牆或者添加防火牆放行端口
這里只演示關閉防火牆命令:centos-6系統命令和centos-7命令不一樣。
centos-6:
[root@asus nginx]# service iptables stop
7、瀏覽器訪問
默認80端口,地址欄輸入:http://192.168.111.240/