• nginx环境下配置nagios-关于nagios配置文件nginx.conf


    接上文:nginx环境下配置nagios-关于nginx.conf


    配置如下:

     1 server
     2 {
     3         listen       80;
     4         server_name  192.168.44.44;
     5         index index.html index.htm index.php;
     6         root  /usr/local/nagios/share;
     7         auth_basic "Nagios Access";
     8         auth_basic_user_file /usr/local/nagios/etc/nagiospasswd;
     9 
    10         location ~ .*.(php|php5)?$
    11         {
    12                 # root /usr/local/nagios/share;
    13                 # fastcgi_pass  unix:/export/servers/nginx/logs/php-cgi.sock;
    14                 fastcgi_pass  127.0.0.1:9000;
    15                 fastcgi_index index.php;
    16                 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    17                 #include fcgi.conf;
    18                 include /export/servers/nginx/conf/fastcgi_params;
    19         }
    20 
    21         location ~ .cgi$
    22         {
    23                 root  /usr/local/nagios/share;
    24                 rewrite ^/nagios/cgi-bin/(.*).cgi /$1.cgi break;
    25                 fastcgi_pass unix:/export/servers/nginx/logs/perl-fcgi.sock;
    26                 fastcgi_index index.cgi;
    27                 #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    28                 fastcgi_param SCRIPT_FILENAME /usr/local/nagios/sbin$fastcgi_script_name;
    29                 #fastcgi_param HTTP_ACCEPT_LANGUAGE en_US;
    30                 include fastcgi_params;
    31         }
    32 
    33         location ~ .pl$
    34         {
    35                 root  /usr/local/nagios/share;
    36                 fastcgi_pass  unix:/export/servers/nginx/logs/nginx-fcgi.sock;
    37                 fastcgi_index index.pl;
    38                 #fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    39                 fastcgi_param SCRIPT_FILENAME /usr/local/nagios/sbin$fastcgi_script_name;
    40                 include /export/servers/nginx/conf/fastcgi_params;
    41         }
    42 
    43         location /nagios/
    44         {
    45                 gzip off;
    46                 alias /usr/local/nagios/share/;
    47         }
    48 
    49         location /stylesheets
    50         {
    51                 gzip off;
    52                 alias /usr/local/nagios/share/stylesheets;
    53         }
    54 
    55         location /pub
    56         {
    57                 gzip off;
    58                 alias /usr/local/nagios/share/docs;
    59         }
    60 
    61         location /pnp4nagios {
    62                 alias /usr/local/pnp4nagios/share;
    63                 index index.php;
    64                 try_files $uri $uri/ @pnp4nagios;
    65         }
    66 
    67         location @pnp4nagios {
    68                 fastcgi_pass  127.0.0.1:9000;
    69                 fastcgi_index       index.php;
    70                 include        fastcgi_params;
    71                 fastcgi_split_path_info ^(.+.php)(.*)$;
    72                 fastcgi_param PATH_INFO $fastcgi_path_info;
    73                 fastcgi_param SCRIPT_FILENAME /usr/local/pnp4nagios/share/index.php;
    74         }
    75 

    76 } 

      1 user                    nagios  nagios;
      2 worker_processes                        4;
      3 worker_cpu_affinity                     00000001 00000010 00000100 00001000;
      4 error_log                /export/servers/nginx/logs/nginx_error.log  notice;
      5 pid                    /export/servers/nginx/logs/nginx.pid;
      6 worker_rlimit_nofile            65535;
      7 events 
      8 {
      9     use epoll;
     10     worker_connections 65535;
     11 }
     12 http 
     13 {
     14     include                   mime.types;
     15     default_type              application/octet-stream;
     16     server_tokens             off;
     17     log_format main             '$remote_addr - $remote_user [$time_local] '
     18         '"$request" $status $bytes_sent '
     19         '"$http_referer" "$http_user_agent" '
     20         '"$gzip_ratio"';
     21     charset              utf-8;
     22     server_names_hash_bucket_size   128;
     23     client_header_buffer_size     32k;
     24     large_client_header_buffers     4 32k;
     25     client_max_body_size         500m;
     26     sendfile             on;
     27     tcp_nopush                 on;
     28     keepalive_timeout         0;
     29     tcp_nodelay             on;
     30     client_body_buffer_size      1024k;
     31     fastcgi_intercept_errors     on;
     32     proxy_connect_timeout         90;
     33     proxy_read_timeout           180;
     34     proxy_send_timeout           180;
     35     proxy_buffer_size            256k;
     36     proxy_buffers                4 256k;
     37     proxy_busy_buffers_size     256k;
     38     proxy_temp_file_write_size     256k;
     39     server_name_in_redirect     off;
     40     proxy_hide_header       X-Powered-By;
     41 
     42     fastcgi_connect_timeout 320m;
     43     fastcgi_send_timeout 320m;
     44     fastcgi_read_timeout 320m;
     45     gzip                 on;
     46     gzip_min_length          100;
     47     gzip_buffers             4 16k;
     48     gzip_http_version         1.0;
     49     gzip_comp_level         9;
     50     gzip_types               text/plain application/x-javascript text/css application/xml;
     51     gzip_vary             on;
     52     error_page  400 401 402 403 404 = /40x.html;
     53 #    error_page  500 501 502 503 504 = /50x.html;
     54     log_format  nagios_logs  '$remote_addr - $remote_user [$time_local] "$request" '
     55         '$status $body_bytes_sent "$http_referer" '
     56         '"$http_user_agent" $http_x_forwarded_for';
     57     access_log  /export/servers/nginx/logs/access_nagios.log  nagios_logs;        
     58 
     59     fastcgi_buffer_size         512k;
     60     fastcgi_buffers             24 512k;
     61     fastcgi_busy_buffers_size   640k;
     62     fastcgi_temp_file_write_size        640k;
     63     include domains/*;
     64 ###########status#########
     65     server
     66     {    
     67         listen                 80;
     68         server_name            status.nginx.com;
     69         location / {
     70         stub_status            on;
     71         access_log             off;
     72         }
     73     }
     74 }
     75 [root@b28-1241 conf]# q
     76 -bash: q: command not found
     77 [root@b28-1241 conf]# vi nginx.conf
     78 
     79                 '"$http_referer" "$http_user_agent" '
     80                 '"$gzip_ratio"';
     81         charset                         utf-8;
     82         server_names_hash_bucket_size   128;
     83         client_header_buffer_size       32k;
     84         large_client_header_buffers     4 32k;
     85         client_max_body_size            500m;
     86         sendfile                        on;
     87         tcp_nopush                      on;
     88         keepalive_timeout               0;
     89         tcp_nodelay                     on;
     90         client_body_buffer_size         1024k;
     91         fastcgi_intercept_errors        on;
     92         proxy_connect_timeout           90;
     93         proxy_read_timeout              180;
     94         proxy_send_timeout              180;
     95         proxy_buffer_size               256k;
     96         proxy_buffers                   4 256k;
     97         proxy_busy_buffers_size         256k;
     98         proxy_temp_file_write_size      256k;
     99         server_name_in_redirect         off;
    100         proxy_hide_header       X-Powered-By;
    101 
    102         fastcgi_connect_timeout 320m;
    103         fastcgi_send_timeout 320m;
    104         fastcgi_read_timeout 320m;
    105         gzip                            on;
    106         gzip_min_length                 100;
    107         gzip_buffers                    4 16k;
    108         gzip_http_version               1.0;
    109         gzip_comp_level                 9;
    110         gzip_types                      text/plain application/x-javascript text/css application/xml;
    111         gzip_vary                       on;
    112         error_page  400 401 402 403 404 = /40x.html;
    113 #       error_page  500 501 502 503 504 = /50x.html;
    114         log_format  nagios_logs  '$remote_addr - $remote_user [$time_local] "$request" '
    115                 '$status $body_bytes_sent "$http_referer" '
    116                 '"$http_user_agent" $http_x_forwarded_for';
    117         access_log  /export/servers/nginx/logs/access_nagios.log  nagios_logs;
    118 
    119         fastcgi_buffer_size         512k;
    120         fastcgi_buffers             24 512k;
    121         fastcgi_busy_buffers_size   640k;
    122         fastcgi_temp_file_write_size        640k;
    123         include domains/*;
    124 ###########status#########
    125         server
    126         {
    127                 listen                 80;
    128                 server_name            status.nginx.com;
    129                 location / {
    130                 stub_status            on;
    131                 access_log             off;
    132                 }
    133         }

    134 } 

  • 相关阅读:
    api1
    录像时调用MediaRecorder的start()时发生start failed: -19错误
    继承AppCompatActivity的Activity隐藏标题栏
    Android 6.0 运行时权限处理完全解析
    Android开发用过的十大框架
    Lite Your Android English
    2015最流行的Android组件、工具、框架大全
    C#调用C++函数入口点的问题 z
    C#调用C++的DLL函数另一则(delegate) z
    C#调用C++编写的DLL函数, 以及各种类型的参数传递 z
  • 原文地址:https://www.cnblogs.com/zhuhongbao/p/3820494.html
Copyright © 2020-2023  润新知