Install nginx from source for your google compute engine vm instance (ubuntu 16.04)

Dependence Installation: zlib, pcre, openssl
sudo apt-get install openssl libssl-dev libpcre3 libpcre3-dev zlib1g-dev
( if you want to compile them from source,
get zlib source:
wget http://zlib.net/zlib-1.2.11.tar.gz
gunzip zlib-1.2.11.tar.gz
tar -xvf zlib-1.2.11.tar
mv zlib-1.2.11 zlib

get pcre source:
svn co svn://vcs.exim.org/pcre2/code/trunk pcre
)


I want to install nginx on my my google compute engine.


First, clone a copy of nginx source. I fork it from nginx's official mirror on github.
git clone https://github.com/lengerrong/nginx.git

–user=*name*
sets the name of an unprivileged user whose credentials will be used by worker processes. After installation, the name can always be changed in the nginx.conf configuration file using the user directive. The default user name is nobody.
–group=*name*
sets the name of a group whose credentials will be used by worker processes. After installation, the name can always be changed in the nginx.conf configuration file using the user directive. By default, a group name is set to the name of an unprivileged user.
More options, please refer to : https://www.nginx.com/resources/wiki/start/topics/tutorials/installoptions/

Ok. let's configure nginx now.
./auto/configure --user="errong.leng" --group="errong.leng" --prefix=/home/errong.leng/local/nginx --with-http_ssl_module --with-http_stub_status_module --with-threads


Configuration done,let make and make install.
PS, I found google compute engine do not have g++/gcc and make program.
so I have to install them manually.
sudo apt-get install g++ make

Finally, nginx installation done.




Let's test our nginx server now.
Start nginx:
errong.leng@instance-1:~/local/nginx$ sudo ./sbin/nginx
Open http://23.251.146.154/ via any browser.
(23.251.145.154 is my external IP of google compute engine,
do not have a domain name yet)

Yes, Welcome to nginx!





Comments

Popular posts from this blog

How to fix error : no module named sendgrid when try to use sendgrid python lib in PHP.

react-native run-android : sun.security.provider.cert path.SunCertPathBuilderException : unable to find valid certification path to req uested target

react-native run-android : do not build/update modified code(App.js)