Hello Nginx!

So far, I configured the apache+tomcat, IIS+apusic, but have never configured Nginx before.

[Forgive me too lazy to install the Chinese Input Method in this nginx test server]

Today, the interesting strongly push me to start this trip of Nginx, I cannot reject this.

Nginx has a quick response for static resources, it can HOLD 500 thousands request per second. It costs only  1/5 CPU and 1/10 memory of apache.

My server is ubuntu16, user is root, as I met the error below when I used a normal user even added to /etc/sudoer.

Fatal error: can't create objs/src/core/nginx.o: 权限不够
make[1]: *** [objs/src/core/nginx.o] 错误 2
make[1]: 离开目录“/usr/local/nginx-1.9.0”
make: *** [build] 错误 2

1st step: installation and configuration

1.1  install components which Nginx relies on.

yum -y install gcc gcc-c++ autoconf automake

yum -y install pcre pcre-devel

yum -y install zlib zlib-devel

yum -y install openssl openssl-devel 

1.2 install nginx

cd /usr/local

sudo wget http://nginx.org/download/nginx-1.9.0.tar.gz

sudo tar -xzvf nginx-1.9.0.tar.gz

cd nginx-1.9.0

./configure --prefix=/usr/local/nginx --with-http_ssl_module &&make &&make install

1.3 check the nginx configuration

/usr/local/nginx/sbin/nginx -t

we will get:

[root@localhost local]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

1.4 start the nginx

/usr/local/nginx/sbin/nginx

1.5 check the process

[root@localhost local]# ps -ef | grep nginx
root     22838     1  0 03:24 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx

nobody   22839 22838  0 03:24 ?        00:00:00 nginx: worker process

we can see, there is a master process and a worker process.

1.6 visit nginx via brower

http://{input the ip address here}:80/

we will get the following content in the page.

Welcome to nginx!

If you see this page, the nginx web server is successfully installed andworking. Further configuration is required.

For online documentation and support please refer tonginx.org.
Commercial support is available atnginx.com.

Thank you for using nginx.

done, celebration!

2. common commands

2.1 stop nginx

/usr/local/nginx/sbin/nginx -s stop

2.2 check nginx version 

/usr/local/nginx/sbin/nginx -V

we will get:

[cloud@localhost ~]$ /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.9.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module

阅读更多
个人分类: Nginx
上一篇IDEA入门笔记
下一篇nginx.conf
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭