How to install NGINX 1.13.10 from source on linux Mint 18.3
To Install and Configure Nginx from Source on Linux Mint 18.3
Nginx is an open source web server that is similar to Apache, but very lightweight. Nginx is both web server and reverses proxy server. It is really so simple to install and configure Nginx from Source on Linux Mint 18.3 and this tutorial covers the ground on the same process.
The following are some of the features of Nginx:
- It serves static and index files
- Reverse proxy with caching
- Supports SSL
- Supports rewrite module
- Supports gzip, XSLT, SSI and image resizing filters
Installation Nginx
Download Nginx latest version from official site from the terminal using wget command.
linuxhelp ~ # wget http://nginx.org/download/nginx-1.13.10.tar.gz
--2018-03-28 20:05:32-- http://nginx.org/download/nginx-1.13.10.tar.gz
Resolving nginx.org (nginx.org)... 206.251.255.63, 95.211.80.227, 2606:7100:1:69::3f, ...
Connecting to nginx.org (nginx.org)|206.251.255.63|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1014863 (991K) [application/octet-stream]
Saving to: ‘ nginx-1.13.10.tar.gz’
nginx-1.13.10.tar.gz 100%[===================================================================> ] 991.08K --.-KB/s in 0.02s
2018-03-28 20:05:43 (48.1 MB/s) - ‘ nginx-1.13.10.tar.gz’ saved [1014863/1014863]
After Downloading extract the package using the following command.
linuxhelp ~ # tar -xzvf nginx-1.13.10.tar.gz
nginx-1.13.10/
nginx-1.13.10/auto/
nginx-1.13.10/conf/
nginx-1.13.10/contrib/
nginx-1.13.10/src/
nginx-1.13.10/configure
nginx-1.13.10/LICENSE
nginx-1.13.10/README
nginx-1.13.10/html/
nginx-1.13.10/man/
nginx-1.13.10/CHANGES.ru
nginx-1.13.10/CHANGES
.
.
nginx-1.13.10/auto/cc/acc
nginx-1.13.10/auto/cc/bcc
nginx-1.13.10/auto/cc/ccc
nginx-1.13.10/auto/cc/conf
nginx-1.13.10/auto/cc/gcc
nginx-1.13.10/auto/cc/icc
nginx-1.13.10/auto/cc/msvc
nginx-1.13.10/auto/cc/name
nginx-1.13.10/auto/cc/owc
nginx-1.13.10/auto/cc/sunc
And then Navigate to the nginx directory and list all the files.
linuxhelp ~ # cd nginx-1.13.10/
linuxhelp nginx-1.13.10 # ls
auto CHANGES CHANGES.ru conf configure contrib html LICENSE man README src
You can find the " configure" file and it will be in an executable format so just run configuration file using the following command.
linuxhelp nginx-1.13.10 # ./configure
checking for OS
+ Linux 4.10.0-38-generic x86_64
checking for C compiler ... found
+ using GNU C compiler
+ gcc version: 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.5)
checking for gcc -pipe switch ... found
checking for -Wl,-E switch ... found
checking for gcc builtin atomic operations ... found
checking for C99 variadic macros ... found
checking for gcc variadic macros ... found
checking for gcc builtin 64 bit byteswap ... found
.
.
ginx path prefix: " /usr/local/nginx"
nginx binary file: " /usr/local/nginx/sbin/nginx"
nginx modules path: " /usr/local/nginx/modules"
nginx configuration prefix: " /usr/local/nginx/conf"
nginx configuration file: " /usr/local/nginx/conf/nginx.conf"
nginx pid file: " /usr/local/nginx/logs/nginx.pid"
nginx error log file: " /usr/local/nginx/logs/error.log"
nginx http access log file: " /usr/local/nginx/logs/access.log"
nginx http client request body temporary files: " client_body_temp"
nginx http proxy temporary files: " proxy_temp"
nginx http fastcgi temporary files: " fastcgi_temp"
nginx http uwsgi temporary files: " uwsgi_temp"
nginx http scgi temporary files: " scgi_temp"
Once the configuration is done we can invoke make to build the software.
linuxhelp nginx-1.13.10 # make
make -f objs/Makefile
make[1]: Entering directory ' /home/user/nginx-1.13.10'
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs
-o objs/src/core/nginx.o
src/core/nginx.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs
-o objs/src/core/ngx_log.o
.
.
objs/src/http/modules/ngx_http_upstream_keepalive_module.o
objs/src/http/modules/ngx_http_upstream_zone_module.o
objs/ngx_modules.o
-ldl -lpthread -lcrypt -lpcre -lz
-Wl,-E
sed -e " s|%%PREFIX%%|/usr/local/nginx|"
-e " s|%%PID_PATH%%|/usr/local/nginx/logs/nginx.pid|"
-e " s|%%CONF_PATH%%|/usr/local/nginx/conf/nginx.conf|"
-e " s|%%ERROR_LOG_PATH%%|/usr/local/nginx/logs/error.log|"
< man/nginx.8 > objs/nginx.8
make[1]: Leaving directory ' /home/user/nginx-1.13.10'
Now the built has been done and we can run using make install.
linuxhelp nginx-1.13.10 # make install
make -f objs/Makefile install
make[1]: Entering directory ' /home/user/nginx-1.13.10'
test -d ' /usr/local/nginx' || mkdir -p ' /usr/local/nginx'
test -d ' /usr/local/nginx/sbin'
|| mkdir -p ' /usr/local/nginx/sbin'
test ! -f ' /usr/local/nginx/sbin/nginx'
|| mv ' /usr/local/nginx/sbin/nginx'
' /usr/local/nginx/sbin/nginx.old'
cp objs/nginx ' /usr/local/nginx/sbin/nginx'
test -d ' /usr/local/nginx/conf'
.
.
cp conf/scgi_params
' /usr/local/nginx/conf/scgi_params.default'
test -f ' /usr/local/nginx/conf/nginx.conf'
|| cp conf/nginx.conf ' /usr/local/nginx/conf/nginx.conf'
cp conf/nginx.conf ' /usr/local/nginx/conf/nginx.conf.default'
test -d ' /usr/local/nginx/logs'
|| mkdir -p ' /usr/local/nginx/logs'
test -d ' /usr/local/nginx/logs'
|| mkdir -p ' /usr/local/nginx/logs'
test -d ' /usr/local/nginx/html'
|| cp -R html ' /usr/local/nginx'
test -d ' /usr/local/nginx/logs'
|| mkdir -p ' /usr/local/nginx/logs'
make[1]: Leaving directory ' /home/user/nginx-1.13.10'
By default, it runs on port 80 but if u have an apache web server already running on your server you should change the port number so let' s Change the listen port.
linuxhelp nginx-1.13.10 # vi /usr/local/nginx/conf/nginx.conf
server {
listen 8081
server_name localhost
Now Start the Nginx server using the following steps.
linuxhelp nginx-1.13.10 # cd /usr/local/nginx/sbin
linuxhelp sbin # ./nginx
linuxhelp sbin # ps -ef | grep -i nginx
root 35064 1 0 20:11 ? 00:00:00 nginx: master process ./nginx
nobody 35065 35064 0 20:11 ? 00:00:00 nginx: worker process
root 35067 7263 0 20:11 pts/0 00:00:00 grep --color=auto -i Nginx
Ngnix is up and running. you can verify it by accessing from the browser. Go to the browser and enter the URL: http://ipaddress:8081

With this, the method to Install and Configure Nginx from Source on Linuxmint comes to an end.
Comments ( 0 )
No comments available