Created
August 11, 2024 19:33
-
-
Save saaiful/c983564f4076e459fa8a7c29d7d5825a to your computer and use it in GitHub Desktop.
server_update.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/openresty.gpg] http://openresty.org/package/ubuntu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/openresty.list > /dev/null | |
sudo apt-get update | |
sudo apt-get -y install openresty | |
rm /usr/local/openresty/nginx/modules/ngx_http_geoip2_module.so | |
openresty=$(openresty -v 2>&1|cut -d "/" -f2) | |
# Download the OpenResty source code | |
wget https://openresty.org/download/openresty-$openresty.tar.gz | |
tar -xzvf openresty-$openresty.tar.gz | |
cd openresty-$openresty | |
# Clone the ngx_http_geoip2_module into the OpenResty build directory | |
git clone https://github.com/leev/ngx_http_geoip2_module.git | |
# Configure OpenResty with the GeoIP2 module | |
GEOIP2_MODULE_PATH="./ngx_http_geoip2_module" # Adjust this path as necessary | |
# Configure OpenResty | |
./configure \ | |
--with-http_v2_module \ | |
--with-http_stub_status_module \ | |
--add-dynamic-module=$GEOIP2_MODULE_PATH | |
# Make and install | |
make -j$(nproc) | |
sudo make install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment