Skip to content

Instantly share code, notes, and snippets.

@RomkaLTU
Last active July 24, 2018 19:08
Show Gist options
  • Save RomkaLTU/bae90fa75e7e2861412aa27daec6fdfc to your computer and use it in GitHub Desktop.
Save RomkaLTU/bae90fa75e7e2861412aa27daec6fdfc to your computer and use it in GitHub Desktop.
Nginx as Proxy + http/2 on CentOS 7
yum install epel-release wget nano mc libtool perl-core zlib-devel yum-utils
yum group install “Development tools”
wget https://zlib.net/zlib-1.2.11.tar.gz
wget http://nginx.org/download/nginx-1.14.0.tar.gz
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.42.tar.gz
tar -xzvf nginx-1.14.0.tar.gz
tar -xzvf pcre-8.42.tar.gz
tar -xzvf zlib-1.2.11.tar.gz
wget https://www.openssl.org/source/openssl-1.1.0h.tar.gz
tar -xzvf openssl-1.1.0h.tar.gz
cd openssl-1.1.0h
./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl shared zlib
make && make install
vim /etc/profile.d/openssl.sh
# /etc/profile.d/openssl.sh
pathmunge /usr/local/openssl/bin
vim /etc/ld.so.conf.d/openssl-1.1.0h.conf
# /etc/ld.so/conf.d/openssl-1.1.0h.conf
/usr/local/openssl/lib
ldconfig -v
cd nginx-1.14.0
./configure --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --with-http_ssl_module --with-openssl=/root/sources/openssl-1.1.0h --with-pcre=/root/sources/pcre-8.42 --with-zlib=/root/sources/zlib-1.2.11 --with-http_gzip_static_module --with-http_v2_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --without-http_fastcgi_module --without-http_uwsgi_module --without-http_scgi_module --without-http_memcached_module --with-http_stub_status_module --with-http_realip_module
make && make install
vim /lib/systemd/system/nginx.service
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/usr/sbin/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
systemctl start nginx
systemctl enable nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment