先参考文章:Deepin 15.7 编译安装 LNMP(PHP 5.6.38 + Nginx 1.14.0 + MySQL 5.6.42)
- libssl 是为了可以使用HTTPS功能
- libpcre 是为了可以使用正则表达式,主要是为了伪静态重写等
- zlib 将文本可以使用gzip压缩等
###安装依赖库 sudo apt-get -y install libpcre3 libpcre3-dev sudo apt-get -y install libssl-dev openssl libcurl4-openssl-dev sudo apt-get -y install build-essential libtool sudo apt-get -y install perl make zlib1g-dev curl ###安装pcre库 cd /alidata/tmp/deepin-sdk/source2/openresty sudo tar -xzvf ./pcre-8.36.tar.gz cd ./pcre-8.36 sudo ./configure sudo make && sudo make install ###安装zlib库 cd /alidata/tmp/deepin-sdk/source2/openresty sudo tar -xzvf ./zlib-1.2.11.tar.gz cd ./zlib-1.2.11 sudo ./configure sudo make sudo make install ###安装ssl cd /alidata/tmp/deepin-sdk/source2/openresty sudo tar -xzvf ./openssl-1.0.1e.tar.gz cd openssl-1.0.1e ###添加nginx用户组及用户 #sudo groupadd www #sudo useradd -g www -s /usr/sbin/nologin www #不让www用户直接登录 ###安装openresty # wget https://openresty.org/download/openresty-1.13.6.2.tar.gz cd /alidata/tmp/deepin-sdk/source2/openresty sudo tar -xzvf ./openresty-1.13.6.2.tar.gz cd ./openresty-1.13.6.2 sudo mkdir -pv /alidata/server/openresty/openresty-1.13 sudo ./configure \ --prefix=/alidata/server/openresty/openresty-1.13 \ --user=wenjianbao \ --group=wenjianbao \ --sbin-path=/alidata/server/openresty/openresty-1.13/nginx/nginx \ --conf-path=/alidata/server/openresty/openresty-1.13/nginx/conf/nginx.conf \ --pid-path=/alidata/server/openresty/openresty-1.13/nginx/logs/nginx.pid \ --with-http_stub_status_module \ --with-http_ssl_module \ --with-http_realip_module \ --with-pcre=/alidata/tmp/deepin-sdk/source2/openresty/pcre-8.36 \ --with-zlib=/alidata/tmp/deepin-sdk/source2/openresty/zlib-1.2.11 \ --with-openssl=/alidata/tmp/deepin-sdk/source2/openresty/openssl-1.0.1e sudo make && make install ###复制配置文件 sudo cp -rf /alidata/tmp/deepin-sdk/config/openresty-1.13/nginx.conf /alidata/server/openresty/openresty-1.13/nginx/conf/nginx.conf ###创建虚拟主机配置文件目录 sudo mkdir /alidata/server/openresty/openresty-1.13/nginx/conf/vhost ###设置权限 sudo chmod -R +x /alidata/server/openresty/openresty-1.13 sudo chown -R wenjianbao:wenjianbao /alidata/server/openresty/openresty-1.13 ###设置开机自动启动 sudo cp -rf /alidata/tmp/deepin-sdk/config/openresty-1.13/nginx.init /etc/init.d/nginx sudo chmod +x /etc/init.d/nginx #添加执行权限 sudo update-rc.d nginx defaults ###sudo service nginx start #启动nginx # sudo killall nginx sudo /etc/init.d/nginx start ### 配置 命令行 工具 sudo rm /usr/local/bin/opm sudo rm /usr/local/bin/resty sudo rm /usr/local/bin/restydoc sudo rm /usr/local/bin/restydoc-index sudo rm /usr/local/bin/openresty sudo rm /usr/local/bin/nginx sudo ln -s /alidata/server/openresty/openresty-1.13/bin/opm /usr/local/bin/opm sudo ln -s /alidata/server/openresty/openresty-1.13/bin/resty /usr/local/bin/resty sudo ln -s /alidata/server/openresty/openresty-1.13/bin/restydoc /usr/local/bin/restydoc sudo ln -s /alidata/server/openresty/openresty-1.13/bin/restydoc-index /usr/local/bin/restydoc-index sudo ln -s /alidata/server/openresty/openresty-1.13/bin/openresty /usr/local/bin/openresty sudo ln -s /alidata/server/openresty/openresty-1.13/nginx/nginx /usr/local/bin/nginx