1. 程式人生 > >初探nginx——安裝

初探nginx——安裝

x86_64 mime file 文件 sta kconfig 服務 ref art

一、

  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/nginx

  5.查看開啟的進程

    $ 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

三、

  配置文件詳解:http://www.cnblogs.com/hunttown/p/5759959.html

初探nginx——安裝