Nginx安裝實例分析

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(之后進入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. 啟動

/usr/local/nginx/sbin/nginx

9. 停止

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

10. 瀏覽器訪問nginx所在機器ip,驗證nginx啟動成功

http://yourhost/

注:nginx配置文件位置

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

? 版權聲明
THE END
喜歡就支持一下吧
點贊12 分享