nginx安裝依賴包
(推薦學習:nginx教程)
-
nginx安裝依賴GCC、openssl-devel、pcre-devel和zlib-devel軟件庫。
-
Pcre全稱(Perl Compatible Regular Expressions),中文perl兼容正則表達式,pcre官方站點。
yum install pcre pcre-devel -y yum install openssl openssl-devel -y
編譯命令
tar -zxf nginx-1.10.1.tar.gz cd nginx-1.10.1/ ./configure --prefix=/data/nginx-1.10.1 --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module useradd nginx -M -s /sbin/nologin make && make install ln -s /data/nginx-1.10.1 /data/nginx
測試nginx配置文件是否正常
/data/nginx/sbin/nginx -t nginx: the configuration file /data/nginx-1.10.1/conf/nginx.conf syntax is ok nginx: configuration file /data/nginx-1.10.1/conf/nginx.conf test is successful
啟動nginx服務器
/data/nginx/sbin/nginx -t ##檢查配置文件 /data/nginx/sbin/nginx ##確定nginx服務 netstat -lntup |grep nginx ## 檢查進程是否正常 curl http://localhost ## 確認結果