-
Notifications
You must be signed in to change notification settings - Fork 56
Building NGINX
Below versions of NGINX are available in respective distributions at the time of creation of these build instructions:
- RHEL (8.8, 8.10) have
1.14.1
- RHEL (9.2, 9.4, 9.5) have
1.20.1
- SLES 15 SP6 has
1.21.5
- Ubuntu 22.04 have
1.18.0
- Ubuntu 24.04 has
1.24.0
- Ubuntu 24.10 has
1.26.0
The instructions provided below specify the steps to build NGINX version 1.28.0 on Linux on IBM Z for following distributions:
- RHEL (8.8, 8.10, 9.2, 9.4, 9.5)
- SLES 15 SP6
- Ubuntu (22.04, 24.04, 24.10)
- When following the steps below please use a standard permission user unless otherwise specified.
- A directory
/<source_root>/
will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.
If you want to build nginx using manual steps, go to STEP 1.2.
Use the following commands to build nginx using the build script. Please make sure you have wget installed.
wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/NGINX/1.28.0/build_nginx.sh
# Build nginx
bash build_nginx.sh
If the build completes successfully, go to STEP 2. In case of error, check logs
for more details or go to STEP 1.2 to follow manual build steps.
export SOURCE_ROOT=/<source_root>/
-
RHEL (8.8, 8.10, 9.2, 9.4, 9.5)
sudo yum install -y pcre-devel wget tar xz gcc make zlib-devel diffutils
-
SLES 15 SP6
sudo zypper install -y pcre-devel curl wget tar xz gcc make zlib-devel diffutils gzip
-
Ubuntu (22.04, 24.04, 24.10)
sudo apt-get update sudo apt-get install -y curl wget tar gcc make libpcre3-dev openssl libssl-dev zlib1g zlib1g-dev
cd $SOURCE_ROOT
wget http://nginx.org/download/nginx-1.28.0.tar.gz
tar xvf nginx-1.28.0.tar.gz
cd nginx-1.28.0
-
Build NGINX
./configure make sudo make install
-
Add binary to
/usr/sbin
sudo cp /usr/local/nginx/sbin/nginx /usr/sbin/
Note: NGINX will be installed in /usr/local/nginx/sbin/
; depending upon user preferences and conventions, it may be necessary to either update PATH
or create links to the executable files.
For example, this simple HTML document provides a bare minimum of text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Test HTML File</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
</head>
<body>
<p>This is a very simple HTML file.</p>
</body>
</html>
This is a simple test of NGINX's proxy functionality, with NGINX serving as a proxy between an HTTP user and the webpage:
worker_processes 3;
error_log logs/error.log;
pid logs/nginx.pid;
worker_rlimit_nofile 8192;
events
{
worker_connections 2048;
}
http
{
index index.html index.htm index.php;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
tcp_nopush on;
server_names_hash_bucket_size 128;
server
{
listen 8080;
root /tmp;
location /
{
}
}
server {
location / {
proxy_pass http://localhost:8080/;
}
}
}
This assumes that the webpage from step 1 is stored in /tmp/index.html
. If this is not the case, modify the definitions for root
and index
accordingly.
Create a user and group named as nobody
if not present.
nginx -c /tmp/nginx.conf
Note that this will normally need to be done as root, or NGINX will not have authority to access one or more ports, such as 80 and 8080.
Navigate a web browser to the address of the server running NGINX. The browser should display the webpage specified in index.html
.
-
RHEL (8.8, 8.10)
sudo yum install -y libedit-devel gd-devel pcre2-devel perl perl-devel openssl-devel libxml2-devel libxslt-devel perl-Cache-Memcached perl-CryptX perl-GD perl-IO-Socket-SSL perl-Test-Harness perl-HTTP-Request-AsCGI perl-FCGI uwsgi uwsgi-plugin-python3
-
RHEL (9.2, 9.4, 9.5)
sudo yum install -y libedit-devel gd-devel pcre2-devel perl perl-devel openssl-devel libxml2-devel libxslt-devel perl-Cache-Memcached perl-CryptX perl-GD perl-IO-Socket-SSL perl-Test-Harness perl-HTTP-Request-AsCGI perl-FCGI uwsgi uwsgi-plugin-python3 ffmpeg-free
-
SLES 15 SP6
sudo zypper install -y libedit-devel gd-devel libGeoIP-devel pcre2-devel libopenssl-devel libxml2-devel libxslt-devel ffmpeg perl-Cache-Memcached perl-CryptX perl-GD perl-IO-Socket-SSL perl-Test-Harness perl-Protocol-WebSocket perl-HTTP-Request-AsCGI perl-FCGI uwsgi uwsgi-python3
-
Ubuntu (22.04, 24.04, 24.10)
sudo apt-get update sudo apt-get install -y libedit-dev libgd-dev libgeoip-dev libpcre2-dev libperl-dev libssl-dev libxml2-dev libxslt1-dev zlib1g-dev ffmpeg libcache-memcached-perl libcryptx-perl libgd-perl libio-socket-ssl-perl libtest-harness-perl libprotocol-websocket-perl libhttp-request-ascgi-perl uwsgi uwsgi-plugin-python3 libscgi-perl
cd $SOURCE_ROOT
git clone https://github.com/nginx/nginx-tests.git
cd nginx-tests
TEST_NGINX_BINARY=$SOURCE_ROOT/nginx-1.28.0/objs/nginx prove .
All tests should pass.
The information provided in this article is accurate at the time of writing, but on-going development in the open-source projects involved may make the information incorrect or obsolete. Please open issue or contact us on IBM Z Community if you have any questions or feedback.