1.安裝依賴
裝nginx前需要提前安裝編譯工具以及庫文件
yum install gcc-c++
yum install libtool
yum install openssl-devel
2.安裝pcre
PCRE 作用是讓 Nginx 支持 Rewrite 功能聊替。去pcre官網(wǎng)下載扁藕,或者wget
pcre-8.20.tar.gz
wget?-cftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.20.tar.gz
cd?/var/local/
tar?-zxf?pcre-8.20.tar.gz
進入目錄:
cd?/var/local/pcre-8.20
編譯安裝:
./configure
make?&&?make?install
查看pcre版本號:?
pcre-config --version
3.安裝nginx
去官網(wǎng)下載nginx或wget柬泽。
nginx-1.0.15.tar.gz
tar?-zxf?nginx-1.0.15.tar.gz
cd?/usr/local
進入安裝目錄:
cd /usr/local/nginx-1.0.15
編譯安裝:
./configure?--user=root?--group=root?--prefix=/usr/local/nginx?--with-http_stub_status_module?--with-http_ssl_module?--with-cc-opt='-O2'?--with-cpu-opt=opteron
make?
make?install
查看nginx版本:
/usr/local/webserver/nginx/sbin/nginx -v
安裝完成