欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Linux下部署Nginx

程序员文章站 2022-06-04 13:15:31
...

安装pcre

[[email protected] home]# yum install -y gcc gcc-c++

[[email protected] home]# wget https://jaist.dl.sourceforge.net/project/pcre/pcre/8.42/pcre-8.42.tar.gz

[[email protected] home]# tar -zxvf pcre-8.42.tar.gz

[[email protected] home]# cd pcre-8.42/

[[email protected] pcre-8.42]# ./configure --prefix=/usr/local/pcre

[[email protected] pcre-8.42]# make

[[email protected] pcre-8.42]# make install

安装zlib

[[email protected] home]# yum install -y zlib*

安装nginx

[[email protected] home]# wget http://nginx.org/download/nginx-1.14.0.tar.gz
[[email protected] home]# tar -zxvf nginx-1.14.0.tar.gz
[[email protected] home]# cd nginx-1.14.0/
[[email protected] nginx-1.14.0]# ./configure --sbin-path=/usr/local/nginx/sbin/nginx  --conf-path=/usr/local/nginx/conf/nginx.conf --pid-path=/usr/local/nginx/sbin/nginx.pid --with-http_ssl_module --with-pcre=../pcre-8.42
[[email protected] nginx-1.14.0]# make
[[email protected] nginx-1.14.0]# make install

测试nginx配置

[[email protected] nginx-1.14.0]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

启动nginx

[[email protected] nginx-1.14.0]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

可以配置软连接

[[email protected] WebSite]# ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx

若修改nginx配置,需reload

[[email protected] WebSite]# nginx -s reload