nginx 프로필 과 관련 명령

9571 단어 웹 서버
[root@ansible ~]# whereis nginx        #  nginx  
nginx: /usr/local/nginx
[root@ansible ~]# cd /usr/local/nginx
[root@ansible nginx]# ls
client_body_temp  conf  fastcgi_temp  html  logs  proxy_temp  sbin  scgi_temp  ssl  uwsgi_temp
conf         ,html      ,logs      ,sbin     nginx  ,ssl  https    

[root@ansible nginx]# cat conf/nginx.conf | grep -v '^$'  #      ,     
#user  nobody; #    
worker_processes  1; #    ,   CPU   
#      
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
#pid        logs/nginx.pid;  #pid  

#          
events {
    worker_connections  1024;   #    worker_process          
}
http {
    include       mime.types;  #  mime  ,   mime.types    
    default_type  application/octet-stream;
    #      
    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';
    #access_log  logs/access.log  main;
    #sendfile      nginx      sendfile   (zero copy   )     ,
    #      ,     on,
    #             IO     ,     off,
    #        I/O    ,     uptime.
    sendfile        on;
    #tcp_nopush     on;
    #keepalive_timeout  0;   #      
    keepalive_timeout  65;
    #gzip  on;   #  gzip  
    #      
    server {
        listen       80;    80  
        server_name  localhost;  #      
        #charset koi8-r;
        #access_log  logs/host.access.log  main;           
        location / {
            root   html; #       
            index  index.html index.htm; #        
        }

    #  nginx     
    location /nginx_status {
    stub_status on;
        access_log off;
        allow all;   ip
        #deny all;   ip
}
        #error_page  404              /404.html;         
        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   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
        #
        #PHP           FastCGI  .   FastCGI    .
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$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;
        #}
    }
    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;
    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
    #HTTPS server
    #
    #https      
    server {
        listen       443 ssl;
        server_name  192.168.29.9;
                 ,    
        ssl_certificate      /usr/local/nginx/ssl/nginx.crt; 
        ssl_certificate_key  /usr/local/nginx/ssl/nginx.key;
    #   keepalive_timeout 70;
    #   server_tokens off;
    #   fastcgi_param   HTTPS       on;
    #   fastcgi_param   HTTPS_SCHEME    https;
    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;
        location / {
            root   html;
            index  index.html index.htm;
         }
     }
}

nginx 관련 명령 설정 이 올 바른 지 검증: nginx - t [root@ansible nginx]# /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
Nginx 버 전 번호 보기: nginx - V [root@ansible nginx]# /usr/local/nginx/sbin/nginx -V nginx version: nginx/1.8.1 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) built with OpenSSL 1.0.2k-fips 26 Jan 2017 TLS SNI support enabled configure arguments: –prefix=/usr/local/nginx –with-http_stub_status_module –with-http_ssl_module
시작 Nginx: nginx 또는 nginx - c [root@ansiblesbin] \ # / usr / local / nginx / sbin / nginx - c / usr / local / nginx / conf / nginx. conf \ # - c 로 설정 파일 을 지정 하지 않 으 면 기본 설정 으로 시작 합 니 다.
Nginx: nginx - s stop [root@ansible sbin]# /usr/local/nginx/sbin/nginx -s stop
정상 정지 또는 닫 기 Nginx: nginx - s quit [root@ansible sbin]# /usr/local/nginx/sbin/nginx -s quit
프로필 수정 다시 불 러 오기 명령: nginx - s reload [root@ansible sbin]# /usr/local/nginx/sbin/nginx -s reload
로그 파일 다시 열기: nginx - s reopen [root@ansible sbin]# /usr/local/nginx/sbin/nginx -s reopen
도움말 정보 열기: nginx - h [root@ansible sbin]# /usr/local/nginx/sbin/nginx -h nginx version: nginx/1.8.1 Usage: nginx [-?hvVtq] [-s signal] [-c filename] [-p prefix] [-g directives]
Options: -?,-h : this help -v : show version and exit -V : show version and configure options then exit -t : test configuration and exit -q : suppress non-error messages during configuration testing -s signal : send signal to a master process: stop, quit, reopen, reload -p prefix : set prefix path (default: /usr/local/nginx/) -c filename : set configuration file (default: conf/nginx.conf) -g directives : set global directives out of configuration file

좋은 웹페이지 즐겨찾기