nginx-noroot : init

This commit is contained in:
unknown 2022-04-23 15:53:57 +07:00
parent a8a3579bd7
commit 0f6ac74c65
Signed by: minoplhy
GPG Key ID: 90667A59A9908AEC
6 changed files with 124 additions and 0 deletions

22
nginx-noroot/README.md Normal file
View File

@ -0,0 +1,22 @@
# NGINX without Root
This is a mini project that I'll find any workaround for building NGINX without relies on Root Required Dependencies as much as possible
# Setup Script
### using Curl
```
curl https://raw.githubusercontent.com/minoplhy/scriptbox/main/nginx-noroot/build.sh | bash
```
### using Wget
```
wget https://raw.githubusercontent.com/minoplhy/scriptbox/main/nginx-noroot/build.sh | ./build.sh
```
# Root Required
I can't figure workaround for these dependencies
```
Openssl (unsuccessful build when using self compiled openssl)
- libssl-dev
```

57
nginx-noroot/build.sh Normal file
View File

@ -0,0 +1,57 @@
Build_directory=~/nginx_build
User_home=~
rm -rf ~/nginx_build
mkdir ~/nginx_build && cd ~/nginx_build
# Get zlib
cd ~/nginx_build
if [[ -f "/usr/bin/curl" ]]; then
curl -L https://zlib.net/zlib-1.2.12.tar.gz --output zlib-1.2.12.tar.gz
elif [[ -f "/usr/bin/wget" ]]; then
wget https://zlib.net/zlib-1.2.12.tar.gz -O zlib-1.2.12.tar.gz
else
echo "Required Dependencies for download zlib doesn't exist"
fi
tar xzf zlib-1.2.12.tar.gz
# Get pcre
cd ~/nginx_build
if [[ -f "/usr/bin/curl" ]]; then
curl -L https://downloads.sourceforge.net/project/pcre/pcre/8.45/pcre-8.45.tar.gz --output pcre-8.45.tar.gz
elif [[ -f "/usr/bin/wget" ]]; then
wget https://downloads.sourceforge.net/project/pcre/pcre/8.45/pcre-8.45.tar.gz -O pcre-8.45.tar.gz
else
echo "Required Dependencies for download pcre doesn't exist"
fi
tar xzf pcre-8.45.tar.gz
# Build Nginx
cd ~/nginx_build
if [[ -f "/usr/bin/curl" ]]; then
curl -L https://nginx.org/download/nginx-1.21.6.tar.gz --output nginx-1.21.6.tar.gz
elif [[ -f "/usr/bin/wget" ]]; then
wget https://nginx.org/download/nginx-1.21.6.tar.gz -O nginx-1.21.6.tar.gz
else
echo "Required Dependencies for download Nginx doesn't exist"
fi
tar xzf pcre-8.45.tar.gz && cd nginx-1.21.6
if [[ -f "/usr/bin/curl" ]]; then
curl https://raw.githubusercontent.com/minoplhy/scriptbox/main/nginx-noroot/configure.sh | bash
elif [[ -f "/usr/bin/wget" ]]; then
wget https://raw.githubusercontent.com/minoplhy/scriptbox/main/nginx-noroot/configure.sh | ./configure.sh
else
echo "Required Dependencies for download configure script doesn't exist"
fi
make && make install
##
##
## Additional Part.
##
##
mkdir -p ~/nginx-settings/temp

41
nginx-noroot/configure.sh Normal file
View File

@ -0,0 +1,41 @@
Build_directory=~/nginx_build
User_home=~
./configure \
--prefix=$User_home/nginx-settings \
--pid-path=run/nginx.pid \
--conf-path=nginx.conf \
--http-log-path=logs/access.log \
--error-log-path=logs/error.log \
--modules-path=modules \
--http-client-body-temp-path=$User_home/nginx-settings/temp/body \
--http-fastcgi-temp-path=$User_home/nginx-settings/temp/fastcgi \
--http-proxy-temp-path=$User_home/nginx-settings/temp/proxy \
--http-scgi-temp-path=$User_home/nginx-settings/temp/scgi \
--http-uwsgi-temp-path=$User_home/nginx-settings/temp/uwsgi \
--with-compat \
--with-debug \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_realip_module \
--with-http_auth_request_module \
--with-http_v2_module \
--with-http_dav_module \
--with-http_slice_module \
--with-threads \
--with-http_addition_module \
--with-http_flv_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_mp4_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_sub_module \
--with-mail=dynamic \
--with-mail_ssl_module \
--with-stream \
--with-stream_realip_module \
--with-stream_ssl_module \
--with-stream_ssl_preread_module \
--with-pcre=$Build_directory/pcre-8.45 \
--with-zlib=$Build_directory/zlib-1.2.12

View File

@ -0,0 +1 @@
~/nginx-settings/sbin/nginx -g 'daemon on; master_process on;' -s reload

View File

@ -0,0 +1,2 @@
~/nginx-settings/sbin/nginx -t -q -g 'daemon on; master_process on;'
~/nginx-settings/sbin/nginx -g 'daemon on; master_process on;'

View File

@ -0,0 +1 @@
start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile ~/nginx-settings/run/nginx.pid