1. 程式人生 > 實用技巧 >Nginx-安裝-執行訪問頁面

Nginx-安裝-執行訪問頁面

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/