Nginx安裝實(shí)例分析

1. 安裝gcc(centos 7之后一般已自帶,可以在第6步失敗后再安裝)

yum install gcc gcc-c++

2. 安裝pcre

yum install -y pcre pcre-devel

3. 安裝zlib

yum install -y zlib zlib-devel

4. 安裝openssl

yum install -y openssl openssl-devel

5. 下載并解壓nginx(之后進(jìn)入nginx目錄)

wget

6. 編譯nginx(加載常用模塊如ssl)

./configure –prefix=/usr/local/nginx –with-http_stub_status_module –with-http_gzip_static_module –with-http_ssl_module

7. 安裝nginx

make && make install

8. 啟動(dòng)

/usr/local/nginx/sbin/nginx

9. 停止

/usr/local/nginx/sbin/nginx -s stop(reload表示重啟)

10. 瀏覽器訪問nginx所在機(jī)器ip,驗(yàn)證nginx啟動(dòng)成功

http://yourhost/

注:nginx配置文件位置

/usr/local/nginx/conf/nginx.conf

? 版權(quán)聲明
THE END
喜歡就支持一下吧
點(diǎn)贊12 分享