如何使用 nginx 代替 apache 配置 xymon hobbit

如何使用 nginx 代替 apache 配置 xymon hobbit

我在 Debian 7 上安装了 xymon,现在apt-get install xymon 我找不到如何配置nginx.conf才能让它工作

我试过这个,但是当我尝试访问时不起作用http://debian.local/xymon,错误 404:

# /etc/nginx/sites-available/debian.local.conf
# HTTP server
server {
    listen   80; ## listen for ipv4; this line is default and implied
    #listen   [::]:80 default_server ipv6only=on; ## listen for ipv6

    # Make site accessible from http://localhost/
    server_name debian.local localhost ;
    # On redirige toutes les requêtes vers HTTPS
    #rewrite ^ https://$server_name$request_uri? permanent;

location ^~ /glpi {
  root /home/cedric/web;
  index index.php;

        location ~ /glpi(/.*\.php) {
        include /etc/nginx/fastcgi_params;
        fastcgi_pass    unix:/var/run/php5-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_index index.php;
        }
}

location ^~ /xymon/ {
                root /usr/lib/hobbit/server/www ;
                index index.html ;
        }

location /cgi-bin/ {
                root /usr/lib/hobbit/cgi-bin/;
}

location /cgi-secure/ {

                alias /usr/lib/hobbit/cgi-secure/ ;
}

}
server {
    listen 443 ssl;
    server_name debian.local localhost ;

    root html;
    index index.html index.htm;

    # Use a self-signed certificate to ensure
    # secure connexion to phpmyadmin
    ssl_certificate debian.local.crt;
    ssl_certificate_key debian.local.key;

    ssl_session_timeout 5m;

    # Access only latest browsers
    ssl_protocols TLSv1.2;
    ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
    ssl_prefer_server_ciphers on;

    location / {
        try_files $uri $uri/ =404;
    }

location /zabbix {
        if ($scheme ~ ^http:){
            rewrite ^(.*)$  https://$host$1 permanent;
        }
        alias                   /usr/share/zabbix;
        index                   index.php;
        error_page              403 404 502 503 504  /zabbix/index.php;

        location ~ \.php$ {
                if (!-f $request_filename) { return 404; }
                expires                 epoch;
                include                 /etc/nginx/fastcgi_params;
                fastcgi_index   index.php;
                fastcgi_pass    unix:/var/run/php5-fpm.sock;
    }

        location ~ \.(jpg|jpeg|gif|png|ico)$ {
                access_log      off;
                expires         33d;
        }

}

 location /phpmyadmin {
           root /usr/share/;
           index index.php index.html index.htm;

           location ~ ^/phpmyadmin/(.+\.php)$ {
                try_files $uri =404;
                root /usr/share/;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script;
                include /etc/nginx/fastcgi_params;
           }
           location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xt))$ {
                   root /usr/share/;
           }
    }
    location /phpMyAdmin {
           rewrite ^/* /phpmyadmin last;
    }

    ## Xcache admin pages
    location /xcache {
        alias /usr/share/xcache/;
        try_files $uri $uri/ /index.php;

        location ~ ^/xcache/(.+\.php)$ {
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_param SCRIPT_FILENAME $request_filename;
            include fastcgi_params;
        }
    }
}

请帮忙。

谢谢

答案1

使它与这个 nginx 配置文件一起工作:

    location ^~ /hobbit {
                alias /usr/lib/hobbit/server/www/ ;
                index index.html ;
        }

location /cgi-bin/ {
                alias /usr/lib/hobbit/cgi-bin/;
}

location /cgi-secure/ {

                alias /usr/lib/hobbit/cgi-secure/ ;
}

相关内容