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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值