一、
yum -y install nginx # 以最简单的方式安装,熟悉应用为主
二、
1.安装完毕,查看下软件版本:
$ rpm -q nginx
nginx-1.10.2-1.el6.x86_64
或
$ /usr/sbin/nginx -v
nginx version: nginx/1.10.2
2.查看下安装清单:
$ rpm -ql nginx
/etc/logrotate.d/nginx
/etc/nginx/conf.d/default.conf /etc/nginx/conf.d/ssl.conf /etc/nginx/conf.d/virtual.conf /etc/nginx/fastcgi.conf /etc/nginx/fastcgi.conf.default /etc/nginx/fastcgi_params /etc/nginx/fastcgi_params.default /etc/nginx/koi-utf /etc/nginx/koi-win /etc/nginx/mime.types /etc/nginx/mime.types.default /etc/nginx/nginx.conf # 主配置文件 /etc/nginx/nginx.conf.default /etc/nginx/scgi_params /etc/nginx/scgi_params.default /etc/nginx/uwsgi_params /etc/nginx/uwsgi_params.default /etc/nginx/win-utf /etc/rc.d/init.d/nginx # 开机自启动脚本 /etc/sysconfig/nginx /usr/lib64/nginx/modules /usr/sbin/nginx # 启动脚本 /usr/share/doc/nginx-1.10.2 /usr/share/doc/nginx-1.10.2/CHANGES /usr/share/doc/nginx-1.10.2/LICENSE /usr/share/doc/nginx-1.10.2/README /usr/share/doc/nginx-1.10.2/README.dynamic /usr/share/doc/nginx-1.10.2/UPGRADE-NOTES-1.0-to-1.10 /usr/share/man/man3/nginx.3pm.gz /usr/share/man/man8/nginx.8.gz /usr/share/nginx/html/404.html # 网 /usr/share/nginx/html/50x.html # 页 /usr/share/nginx/html/index.html # 的 /usr/share/nginx/html/nginx-logo.png # 目 /usr/share/nginx/html/poweredby.png # 录 /usr/share/vim/vimfiles/ftdetect/nginx.vim /usr/share/vim/vimfiles/indent/nginx.vim /usr/share/vim/vimfiles/syntax/nginx.vim /var/lib/nginx /var/lib/nginx/tmp /var/log/nginx # 日志文件3.启动并设置为开机自启
$ service nginx start
$ chkconfig nginx on
4.查看网络服务状态
$ netstat -anptu | grep --color ':80'
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3549/nginx
tcp 0 0 :::80 :::* LISTEN 3549/nginx5.查看开启的进程
$ ps aux | grep -v 'grep' | grep --color 'nginx'
root 3549 0.0 0.2 108900 2036 ? Ss 18:42 0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx 3550 0.0 0.2 109328 2740 ? S 18:42 0:00 nginx: worker process nginx 3551 0.0 0.2 109328 2720 ? S 18:42 0:00 nginx: worker process三、
配置文件详解: