Skip to content

Instantly share code, notes, and snippets.

@felipebergamaschi
Created December 11, 2018 11:40
Show Gist options
  • Save felipebergamaschi/8ee3b7383fc8f3886b67cafc3cc482c3 to your computer and use it in GitHub Desktop.
Save felipebergamaschi/8ee3b7383fc8f3886b67cafc3cc482c3 to your computer and use it in GitHub Desktop.
nginx compile and install
mkdir -p /opt/compile-nginx
cd /opt/compile-nginx
yum groupinstall -y 'Development Tools'
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz
tar -zxf pcre-8.41.tar.gz
wget http://zlib.net/zlib-1.2.11.tar.gz
tar -zxf zlib-1.2.11.tar.gz
wget http://www.openssl.org/source/openssl-1.0.2k.tar.gz
tar -zxf openssl-1.0.2k.tar.gz
wget http://nginx.org/download/nginx-1.12.2.tar.gz
tar zxf nginx-1.12.2.tar.gz
cd ./nginx-1.12.2
./configure --prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--modules-path=/usr/lib64/nginx/modules \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--user=nginx \
--group=nginx \
--build=RedhatOS-BuildUnicesumarStudeo \
--builddir=nginx-1.12.2 \
--with-poll_module \
--with-threads \
--with-file-aio \
--with-http_ssl_module \
--with-http_gzip_static_module \
--with-http_degradation_module \
--http-log-path=/var/log/nginx/access.log \
--http-client-body-temp-path=/var/cache/nginx/client_temp \
--without-select_module \
--without-http_ssi_module \
--without-http_userid_module \
--without-http_auth_basic_module \
--without-http_geo_module \
--without-http_map_module \
--without-http_split_clients_module \
--without-http_referer_module \
--without-http_proxy_module \
--without-http_fastcgi_module \
--without-http_uwsgi_module \
--without-http_scgi_module \
--without-http_memcached_module \
--without-http_limit_conn_module \
--without-http_limit_req_module \
--without-http_empty_gif_module \
--without-http_browser_module \
--without-http_upstream_hash_module \
--without-http_upstream_ip_hash_module \
--without-http_upstream_least_conn_module \
--without-http_upstream_keepalive_module \
--without-http_upstream_zone_module \
--without-http-cache \
--without-mail_pop3_module \
--without-mail_imap_module \
--without-mail_smtp_module \
--without-stream_limit_conn_module \
--without-stream_access_module \
--without-stream_geo_module \
--without-stream_map_module \
--without-stream_split_clients_module \
--without-stream_return_module \
--without-stream_upstream_hash_module \
--without-stream_upstream_least_conn_module \
--without-stream_upstream_zone_module \
--with-compat \
--with-pcre=../pcre-8.41 \
--with-pcre-jit \
--with-zlib=../zlib-1.2.11 \
--with-openssl=../openssl-1.0.2k \
--with-openssl-opt=no-nextprotoneg \
--with-debug
make
make install
mkdir -p /var/cache/nginx/client_temp
useradd --system --home /var/cache/nginx --shell /sbin/nologin --comment "nginx user" --user-group nginx
nginx -t
touch /usr/lib/systemd/system/nginx.service
cat > /usr/lib/systemd/system/nginx.service <<EOF
[Unit]
Description=nginx - high performance web server - Build Unicesumar Studeo
Documentation=https://nginx.org/en/docs/
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf
ExecReload=/bin/kill -s HUP \$MAINPID
ExecStop=/bin/kill -s TERM \$MAINPID
[Install]
WantedBy=multi-user.target
EOF
systemctl start nginx.service
systemctl enable nginx.service
sudo systemctl status nginx.service
ps aux | grep nginx
curl -I 127.0.0.1
rm -rf /etc/nginx/koi-utf /etc/nginx/koi-win /etc/nginx/win-utf
rm -rf /etc/nginx/*.default
systemctl restart nginx.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment