目录
1、安装依赖的包
安装nginx需要openssl、zlib、pcre。
我将所有的安装包都放在了/usr/local/software/installnginx下
cd /usr/local/software/installnginx
tar zxf openssl-1.1.1a.tar.gz
mv openssl-1.1.1a openssl
tar zxf zlib-1.2.11.tar.gz
mv zlib-1.2.11 zlib
unzip pcre-8.42.zip
mv pcre-8.42 pcre
2、创建管理nginx的用户
groupadd www
useradd -r -g www www -s /sbin/nologin
3、解压安装nginx
tar zxf nginx-1.15.7.tar.gz
cd nginx-1.15.7
./configure \
"--prefix=/usr/local/nginx" \
"--http-client-body-temp-path=/tmp/clientbody" \
"--http-proxy-temp-path=/tmp/proxy" \
"--http-fastcgi-temp-path=/tmp/fastcgi" \
"--http-uwsgi-temp-path=/tmp/uwsgi" \
"--http-scgi-temp-path=/tmp/scgi" \
"--user=www" \
"--group=www" \
"--with-file-aio" \
"--with-http_realip_module" \
"--with-http_ssl_module" \
"--with-openssl=/usr/local/software/installnginx/openssl" \
"--with-http_gzip_static_module" \
"--with-zlib=/usr/local/software/installnginx/zlib" \
"--with-http_stub_status_module" \
"--with-pcre=/usr/local/software/installnginx/pcre"
make&&make install
4、创建相关的目录
创建配置虚拟主机的目录
mkdir /usr/local/shopnc/nginx/conf/vhosts
创建存放pid的目录
mkdir -p /usr/local/shopnc/nginx/run
chown -R www:www /usr/local/shopnc/nginx/run