Skip to content

Instantly share code, notes, and snippets.

@Ray33
Last active August 3, 2020 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ray33/2446444919a01e6fb83e1d753b2a245f to your computer and use it in GitHub Desktop.
Save Ray33/2446444919a01e6fb83e1d753b2a245f to your computer and use it in GitHub Desktop.
devOps - replace old nginx with openresty
#Based on: https://www.linuxsecrets.com/1631-complete-guide-installing-openresty-a-nginx-full-fledged-web-server-on-redhat-scientific-linux-debian
#Get openSSL version that you want to compile with
cd /usr/local/src
wget https://www.openssl.org/source/openssl-1.1.1f.tar.gz
tar zxvf openssl-1.1.1f.tar.gz
#Get Open resty version
cd /tmp
wget https://openresty.org/download/openresty-1.17.8.2.tar.gz
tar zxvf openresty-1.17.8.2.tar.gz
cd openresty-1.17.8.2
./configure \
--modules-path=/usr/local/openresty/modules \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/conf/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-client-body-temp-path=/var/lib/nginx/body \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--http-log-path=/var/log/nginx/access.log \
--http-proxy-temp-path=/var/lib/nginx/proxy \
--http-scgi-temp-path=/var/lib/nginx/scgi \
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
--lock-path=/var/lock/nginx.lock \
--pid-path=/var/log/nginx/nginx.pid \
--with-luajit \
--with-http_geoip_module \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-openssl=/usr/local/src/openssl-1.1.1f \
--with-openssl-opt="shared zlib enable-ssl3 enable-ssl3-method enable-weak-ssl-ciphers enable-ec_nistp_64_gcc_128 enable-tls1_3" \
--with-http_sub_module \
--with-http_v2_module \
--with-ipv6 \
--with-sha1=/usr/include/openssl \
--with-md5=/usr/include/openssl \
--with-http_secure_link_module #
rm -rf /etc/nginx
mkdir /etc/nginx
unlink /usr/sbin/nginx
make -j40
make install
mkdir -p /var/lib/nginx
mkdir -p /var/lib/nginx/body
mkdir -p /var/lib/nginx/fastcgi
mkdir /usr/local/openresty/nginx/conf
cd /etc/nginx
ln -s /usr/local/openresty/nginx/conf conf
mv -f *.* conf
mv -f *_* conf
mv -f *-* conf
#link to any required configuration ln -s PATH_TO_CONFIG_/nginx/conf/include_conf include_conf
rm -rf /etc/init.d/nginx
touch /etc/init.d/nginx
#copy https://gist.github.com/vdel26/8805927 into /etc/init.d/nginx
# #Adjust lines:
# PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# DESC="Nginx Daemon"
# NAME=nginx
# PREFIX=/usr/local/openresty/nginx
# DAEMON=/sbin/$NAME
# CONF=/etc/nginx/conf/$NAME.conf
# PID=/var/log/nginx/$NAME.pid
# SCRIPT=/etc/init.d/$NAME
chkconfig --add nginx
chkconfig --level 345 nginx on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment