CentOS 6.8 yum 설치 Nginx

3039 단어 Nginx
1. nginx yum 소스 다운로드
#   yum   
cd /etc/yum.repos.d

#  nginx yum 
wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm  

2. 설치
#  
rpm -ivh nginx-release-centos-6-0.el6.ngx.noarch.rpm   #  yum   nginx.repo

#     
yum list | grep nginx

#    
nginx-release-centos.noarch                6-0.el6.ngx                   installed
nginx.x86_64                               1.16.0-1.el6.ngx              nginx  
nginx-debug.x86_64                         1.8.0-1.el6.ngx               nginx  
nginx-debuginfo.x86_64                     1.16.0-1.el6.ngx              nginx  
nginx-module-geoip.x86_64                  1.16.0-1.el6.ngx              nginx  
nginx-module-geoip-debuginfo.x86_64        1.16.0-1.el6.ngx              nginx  
nginx-module-image-filter.x86_64           1.16.0-1.el6.ngx              nginx  
nginx-module-image-filter-debuginfo.x86_64 1.16.0-1.el6.ngx              nginx  
nginx-module-njs.x86_64                    1.16.0.0.3.2-1.el6.ngx        nginx  
nginx-module-njs-debuginfo.x86_64          1.16.0.0.3.2-1.el6.ngx        nginx  
nginx-module-perl.x86_64                   1.16.0-1.el6.ngx              nginx  
nginx-module-perl-debuginfo.x86_64         1.16.0-1.el6.ngx              nginx  
nginx-module-xslt.x86_64                   1.16.0-1.el6.ngx              nginx  
nginx-module-xslt-debuginfo.x86_64         1.16.0-1.el6.ngx              nginx  
nginx-nr-agent.noarch                      2.0.0-12.el6.ngx              nginx  
pcp-pmda-nginx.x86_64                      3.10.9-9.el6                  base 

#  nginx
yum install nginx.x86_64  

3. 시동
service nginx start

4. nginx 프로필 
#  php
vi /etc/nginx/conf.d/default.conf

* $document_root: \ # 사이트 의 루트 디 렉 터 리, server 설정 에서 루트 명령 에서 지정 한 값 
server {
    listen       80;   #      
    server_name  localhost;  #    
    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    root   /usr/share/nginx/html;     #        
    index  index.php index.html index.htm;    #      

    #error_page  404              /404.html;   #   404  
    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;   #          ,       
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}
    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

좋은 웹페이지 즐겨찾기