Comments on How to Build NGINX from source on Ubuntu 18.04 LTS

In this tutorial, we will build NGINX with all available modules in open source version of NGINX and we will use mainline version which is at 1.15.0 at the time of this writing.

13 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: Martin

Very nice tutorial. Appreciate your work here!

I wanted to downgrade from nginx-1.14 to nginx-.1.10.3 and managed to do it following your tutorial.

By: Martin

Thant's some awesome tutorial. Thank you verry much sir !!

By: Richard

Got the following error when 'make'.

rm: cannot remove '.libs/libpcre.a': Permission denied

rm: cannot remove '.libs/libpcre.la': Permission denied

rm: cannot remove '.libs/libpcre.lai': Permission denied

ar: could not create temporary file whilst writing archive: No more archived files

Makefile:1429: recipe for target 'libpcre.la' failed

make[2]: *** [libpcre.la] Error 1

make[2]: Leaving directory '/home/richard/Downloads/pcre-8.42'

nginx-1.14.2/Makefile:2016: recipe for target '../pcre-8.42/.libs/libpcre.a' failed

make[1]: *** [../pcre-8.42/.libs/libpcre.a] Error 2

make[1]: Leaving directory '/home/richard/Downloads/nginx-1.14.2'

Makefile:8: recipe for target 'build' failed

make: *** [build] Error 2

 

Doesn't work when you get to this step.

./configure --prefix=/etc/nginx \             --sbin-path=/usr/sbin/nginx \             --modules-path=/usr/lib/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=Ubuntu \            --builddir=nginx-1.15.0 \            --with-select_module \            --with-poll_module \            --with-threads \            --with-file-aio \            --with-http_ssl_module \            --with-http_v2_module \            --with-http_realip_module \            --with-http_addition_module \            --with-http_xslt_module=dynamic \            --with-http_image_filter_module=dynamic \            --with-http_geoip_module=dynamic \            --with-http_sub_module \            --with-http_dav_module \            --with-http_flv_module \            --with-http_mp4_module \            --with-http_gunzip_module \            --with-http_gzip_static_module \            --with-http_auth_request_module \            --with-http_random_index_module \            --with-http_secure_link_module \            --with-http_degradation_module \            --with-http_slice_module \            --with-http_stub_status_module \            --with-http_perl_module=dynamic \            --with-perl_modules_path=/usr/share/perl/5.26.1 \            --with-perl=/usr/bin/perl \            --http-log-path=/var/log/nginx/access.log \            --http-client-body-temp-path=/var/cache/nginx/client_temp \            --http-proxy-temp-path=/var/cache/nginx/proxy_temp \            --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \            --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \            --http-scgi-temp-path=/var/cache/nginx/scgi_temp \            --with-mail=dynamic \            --with-mail_ssl_module \            --with-stream=dynamic \            --with-stream_ssl_module \            --with-stream_realip_module \            --with-stream_geoip_module=dynamic \            --with-stream_ssl_preread_module \            --with-compat \            --with-pcre=../pcre-8.42 \            --with-pcre-jit \            --with-zlib=../zlib-1.2.11 \            --with-openssl=../openssl-1.1.0h \            --with-openssl-opt=no-nextprotoneg \            --with-debug

 

I get no such file or directory for all the directories listed above...

 

By: Nick

Best writeup I've seen yet on installing Nginx from scratch. Thanks so much for this!

A couple of quick notes,

1) When you hit the configure, and compile nginx step, the author leaves out a crucial bit of info (or maybe it's just inherinited known if you're a pro linux user), but the configure command needs to all be on one line. Ie, you need to rmove the \'s between commands. Yes, it creates a monster config statement, but that was the only way I could get it to move past the directory not found error.

2) The author has also omitted the creation of the default nginx conf file. Typically this lives in the sites-available folder. If you're planning on creating virtual hosts, you'd place them in this folder as well.

3) Then symbolic links should be created from the sites-enabled folder to the sites available folder.

Otherwise this was a great tutorial. Thanks again! :)

By: Raghav

That's a nice article.

I had one doubt which is, I don't have the sites-enabled or sites-available directories. So, if I want to define the server block, which is the file I have to edit ? Can anyone help ?

By: Lask9ngt

thanks a lot .

after this step ./configure .... ,I found not everything found during compile. also i can't 'make' or 'make install'. 

By: kochBarma

When I ran the command below I got the error bash: --conf-path=/etc/nginx/nginx.conf: No such file or directoryI am new to linux. How do I fix that issue?

./configure --prefix=/etc/nginx \             --sbin-path=/usr/sbin/nginx \             --modules-path=/usr/lib/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=Ubuntu \            --builddir=nginx-1.15.0 \            --with-select_module \            --with-poll_module \            --with-threads \            --with-file-aio \            --with-http_ssl_module \            --with-http_v2_module \            --with-http_realip_module \            --with-http_addition_module \            --with-http_xslt_module=dynamic \            --with-http_image_filter_module=dynamic \            --with-http_geoip_module=dynamic \            --with-http_sub_module \            --with-http_dav_module \            --with-http_flv_module \            --with-http_mp4_module \            --with-http_gunzip_module \            --with-http_gzip_static_module \            --with-http_auth_request_module \            --with-http_random_index_module \            --with-http_secure_link_module \            --with-http_degradation_module \            --with-http_slice_module \            --with-http_stub_status_module \            --with-http_perl_module=dynamic \            --with-perl_modules_path=/usr/share/perl/5.26.1 \            --with-perl=/usr/bin/perl \            --http-log-path=/var/log/nginx/access.log \            --http-client-body-temp-path=/var/cache/nginx/client_temp \            --http-proxy-temp-path=/var/cache/nginx/proxy_temp \            --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \            --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \            --http-scgi-temp-path=/var/cache/nginx/scgi_temp \            --with-mail=dynamic \            --with-mail_ssl_module \            --with-stream=dynamic \            --with-stream_ssl_module \            --with-stream_realip_module \            --with-stream_geoip_module=dynamic \            --with-stream_ssl_preread_module \            --with-compat \            --with-pcre=../pcre-8.42 \            --with-pcre-jit \            --with-zlib=../zlib-1.2.11 \            --with-openssl=../openssl-1.1.0h \            --with-openssl-opt=no-nextprotoneg \            --with-debug

By: Abhishek

Please make all the keyword align in correct way it will work.

Perfect work!

A professional approach, error-free, and excellent!

By: Rick

I have the same exact error as below with:

"When I ran the command below I got the error bash: --conf-path=/etc/nginx/nginx.conf: No such file or directoryI am new to linux. How do I fix that issue?"

You say to line up the kewords, what does that mean exactly. Shouldn't we just be able to cut and paste your code and have it work?

By: Alex

Hi bro,

 

I applied this command and lost control of my server, what happened?

 

The commands that it applied told me that the directory did not exist.

 

Oh my God!

 

By: david

Thank's some awesome tutorial. Thank you very much, sir.