{"id":2275,"date":"2011-11-23T13:10:12","date_gmt":"2011-11-23T13:10:12","guid":{"rendered":"https:\/\/supportex.net\/?p=2275"},"modified":"2019-05-10T17:29:48","modified_gmt":"2019-05-10T15:29:48","slug":"migration-nagios-apache-nginx","status":"publish","type":"post","link":"https:\/\/supportex.net\/blog\/2011\/11\/migration-nagios-apache-nginx\/","title":{"rendered":"Migrating Nagios from Apache to Nginx"},"content":{"rendered":"<p><a href=\"http:\/\/www.nagios.org\/\">Nagios<\/a> is powerful monitoring software. And like OTRS in most cases it&#8217;s used with Apache. But sometimes you might want to use it with nginx. Here is a simple way to do that. Actually it&#8217;s very similar to <a href=\"https:\/\/supportex.net\/blog\/2011\/11\/migrating-otrs-apache-nginx\/\">launching OTRS with nginx<\/a> &#8211; in both ways we use Perl FastCGI wrapper. I assume that you already have Nagios installed and use Fedora 15. \u00a0<a href=\"http:\/\/www.ruby-forum.com\/attachment\/1583\/fastcgi-wrapper.pl\">Download<\/a> Perl FastCGI wrapper and put it to \/usr\/local\/bin\/fastcgi-wrapper.pl. \u00a0Modify it to use TCP socket:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">$socket = FCGI::OpenSocket( \"127.0.0.1:9002\", 10 ); #use IP sockets<\/pre>\n<p>Put this systemd configuration file to \/lib\/systemd\/system\/fcgi-perl.service:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">[Unit]\nDescription=fastcgi-wrapper.pl\n[Service]\nExecStart=\/usr\/local\/bin\/fastcgi-wrapper.pl\nType=forking\nUser=apache\nGroup=apache\nRestart=always\n[Install]\nWantedBy=multi-user.target<\/pre>\n<p>Enable it:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">systemctl enable fcgi-perl.service<\/code><\/p>\n<p>For using Nagios web interface you also need to have PHP processes pool, in our case it listens TCP socket 127.0.0.1:9005. So if you don&#8217;t have one, you need to launch it (convenient way to do that is to use spawn-fcgi tool).<\/p>\n<p>Add next lines to your nginx server configuration file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">location \/nagios {\nalias \/usr\/share\/nagios\/html;\nindex index.php;\n}\n\nlocation ~ ^\/nagios\/(.*.php)$  {\nroot \/usr\/share\/nagios\/html\/;\nrewrite ^\/nagios\/(.*) \/$1 break;\nfastcgi_index index.php;\ninclude \/etc\/nginx\/fastcgi_params;\nfastcgi_param  SCRIPT_FILENAME  \/usr\/share\/nagios\/html$fastcgi_script_name;\nfastcgi_pass 127.0.0.1:9005;\n}\n\nlocation ~ ^\/nagios\/cgi-bin\/\n{\nroot \/usr\/lib64\/nagios\/cgi-bin\/;\nrewrite ^\/nagios\/cgi-bin\/(.*).cgi \/$1.cgi break;\ninclude \/etc\/nginx\/fastcgi_params;\nfastcgi_param  AUTH_USER $remote_user;\nfastcgi_param  REMOTE_USER $remote_user;\nfastcgi_param SCRIPT_FILENAME \/usr\/lib64\/nagios\/cgi-bin$fastcgi_script_name;\nfastcgi_pass   127.0.0.1:9002;\n\n}<\/pre>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">service nginx restart<\/code><\/p>\n<p>Now your Nagios web interface should be accessible via http:\/\/yourdomain.com\/nagios<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nagios is powerful monitoring software. And like OTRS in most cases it&#8217;s used with Apache. But sometimes you might want to use it with nginx. Here is a simple way to do that. Actually it&#8217;s very similar to launching OTRS with nginx &#8211; in both ways we use Perl FastCGI wrapper. I assume that you&hellip; <\/p>\n<div class=\"readmore-wrapper\"><a href=\"https:\/\/supportex.net\/blog\/2011\/11\/migration-nagios-apache-nginx\/\" class=\"more-link\">Read <\/a><\/div>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[152],"tags":[249,275,161,201,246],"class_list":["post-2275","post","type-post","status-publish","format-standard","hentry","category-linux","tag-apache-en","tag-linux","tag-monitoring","tag-nagios-en","tag-nginx-en"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Migrating Nagios from Apache to Nginx &#8211; Supportex.NET blog<\/title>\n<meta name=\"description\" content=\"How to move Nagios from Apache to Nginx. Migrating Nagios from Apache to Nginx\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/supportex.net\/blog\/2011\/11\/migration-nagios-apache-nginx\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Migrating Nagios from Apache to Nginx &#8211; Supportex.NET blog\" \/>\n<meta property=\"og:description\" content=\"How to move Nagios from Apache to Nginx. Migrating Nagios from Apache to Nginx\" \/>\n<meta property=\"og:url\" content=\"https:\/\/supportex.net\/blog\/2011\/11\/migration-nagios-apache-nginx\/\" \/>\n<meta property=\"og:site_name\" content=\"Supportex.NET blog\" \/>\n<meta property=\"article:published_time\" content=\"2011-11-23T13:10:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-05-10T15:29:48+00:00\" \/>\n<meta name=\"author\" content=\"Oleksii Tykhonov\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Oleksii Tykhonov\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/supportex.net\/blog\/2011\/11\/migration-nagios-apache-nginx\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/supportex.net\/blog\/2011\/11\/migration-nagios-apache-nginx\/\"},\"author\":{\"name\":\"Oleksii Tykhonov\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251\"},\"headline\":\"Migrating Nagios from Apache to Nginx\",\"datePublished\":\"2011-11-23T13:10:12+00:00\",\"dateModified\":\"2019-05-10T15:29:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/supportex.net\/blog\/2011\/11\/migration-nagios-apache-nginx\/\"},\"wordCount\":166,\"keywords\":[\"Apache\",\"linux\",\"monitoring\",\"nagios\",\"nginx\"],\"articleSection\":[\"linux\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/supportex.net\/blog\/2011\/11\/migration-nagios-apache-nginx\/\",\"url\":\"https:\/\/supportex.net\/blog\/2011\/11\/migration-nagios-apache-nginx\/\",\"name\":\"Migrating Nagios from Apache to Nginx &#8211; Supportex.NET blog\",\"isPartOf\":{\"@id\":\"https:\/\/supportex.net\/blog\/en\/#website\"},\"datePublished\":\"2011-11-23T13:10:12+00:00\",\"dateModified\":\"2019-05-10T15:29:48+00:00\",\"author\":{\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251\"},\"description\":\"How to move Nagios from Apache to Nginx. Migrating Nagios from Apache to Nginx\",\"breadcrumb\":{\"@id\":\"https:\/\/supportex.net\/blog\/2011\/11\/migration-nagios-apache-nginx\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/supportex.net\/blog\/2011\/11\/migration-nagios-apache-nginx\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/supportex.net\/blog\/2011\/11\/migration-nagios-apache-nginx\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/supportex.net\/blog\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Migrating Nagios from Apache to Nginx\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#website\",\"url\":\"https:\/\/supportex.net\/blog\/en\/\",\"name\":\"Supportex.NET blog\",\"description\":\"Server and network management company\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/supportex.net\/blog\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251\",\"name\":\"Oleksii Tykhonov\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g\",\"caption\":\"Oleksii Tykhonov\"},\"url\":\"https:\/\/supportex.net\/blog\/author\/oleksiitykhonov\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Migrating Nagios from Apache to Nginx &#8211; Supportex.NET blog","description":"How to move Nagios from Apache to Nginx. Migrating Nagios from Apache to Nginx","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/supportex.net\/blog\/2011\/11\/migration-nagios-apache-nginx\/","og_locale":"en_US","og_type":"article","og_title":"Migrating Nagios from Apache to Nginx &#8211; Supportex.NET blog","og_description":"How to move Nagios from Apache to Nginx. Migrating Nagios from Apache to Nginx","og_url":"https:\/\/supportex.net\/blog\/2011\/11\/migration-nagios-apache-nginx\/","og_site_name":"Supportex.NET blog","article_published_time":"2011-11-23T13:10:12+00:00","article_modified_time":"2019-05-10T15:29:48+00:00","author":"Oleksii Tykhonov","twitter_misc":{"Written by":"Oleksii Tykhonov","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/supportex.net\/blog\/2011\/11\/migration-nagios-apache-nginx\/#article","isPartOf":{"@id":"https:\/\/supportex.net\/blog\/2011\/11\/migration-nagios-apache-nginx\/"},"author":{"name":"Oleksii Tykhonov","@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251"},"headline":"Migrating Nagios from Apache to Nginx","datePublished":"2011-11-23T13:10:12+00:00","dateModified":"2019-05-10T15:29:48+00:00","mainEntityOfPage":{"@id":"https:\/\/supportex.net\/blog\/2011\/11\/migration-nagios-apache-nginx\/"},"wordCount":166,"keywords":["Apache","linux","monitoring","nagios","nginx"],"articleSection":["linux"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/supportex.net\/blog\/2011\/11\/migration-nagios-apache-nginx\/","url":"https:\/\/supportex.net\/blog\/2011\/11\/migration-nagios-apache-nginx\/","name":"Migrating Nagios from Apache to Nginx &#8211; Supportex.NET blog","isPartOf":{"@id":"https:\/\/supportex.net\/blog\/en\/#website"},"datePublished":"2011-11-23T13:10:12+00:00","dateModified":"2019-05-10T15:29:48+00:00","author":{"@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251"},"description":"How to move Nagios from Apache to Nginx. Migrating Nagios from Apache to Nginx","breadcrumb":{"@id":"https:\/\/supportex.net\/blog\/2011\/11\/migration-nagios-apache-nginx\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/supportex.net\/blog\/2011\/11\/migration-nagios-apache-nginx\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/supportex.net\/blog\/2011\/11\/migration-nagios-apache-nginx\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/supportex.net\/blog\/en\/"},{"@type":"ListItem","position":2,"name":"Migrating Nagios from Apache to Nginx"}]},{"@type":"WebSite","@id":"https:\/\/supportex.net\/blog\/en\/#website","url":"https:\/\/supportex.net\/blog\/en\/","name":"Supportex.NET blog","description":"Server and network management company","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/supportex.net\/blog\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251","name":"Oleksii Tykhonov","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g","caption":"Oleksii Tykhonov"},"url":"https:\/\/supportex.net\/blog\/author\/oleksiitykhonov\/"}]}},"_links":{"self":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts\/2275","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/comments?post=2275"}],"version-history":[{"count":4,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts\/2275\/revisions"}],"predecessor-version":[{"id":3166,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts\/2275\/revisions\/3166"}],"wp:attachment":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/media?parent=2275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/categories?post=2275"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/tags?post=2275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}