{"id":12591,"date":"2021-12-07T04:14:23","date_gmt":"2021-12-07T04:14:23","guid":{"rendered":"https:\/\/linuxways.net\/?p=12591"},"modified":"2021-12-07T04:14:23","modified_gmt":"2021-12-07T04:14:23","slug":"monitor-your-nginx-web-proxy-server-using-amplify","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/centos\/monitor-your-nginx-web-proxy-server-using-amplify\/","title":{"rendered":"Monitor your NGINX web\/proxy server using Amplify"},"content":{"rendered":"<p>As Nginx is one of the most widely used open source web servers, it is better to monitor such servers. Amplify is one such capable monitoring tool which has a great role for the better handling of the server. It is based on a SaaS (Software as a Service) monitoring platform. It also has support for Nginx Plus, php-fpm and other components of the underlying operating system.<\/p>\n<p>It has support for all Linux distributions such as Ubuntu, Debian, Fedora, Centos, RHEL, and so on. It has great monitoring capabilities for almost all the things involved on the Nginx server like Network traffic, Memory Usage, CPU Usage, HTTP errors, HTTP version, Nginx traffic.<\/p>\n<p>In this article, we are going to discuss and show the installation process and use cases with its feature of the Web user interface where you can see all the reports and statistics involved on the Nginx server.<\/p>\n<h2>Creating an Account on Nginx Amplify Website and download amplify agent script<\/h2>\n<p>First, let&#8217;s visit the Nginx Amplify website then create an account. After creating the account, you will receive an email to verify the account.<\/p>\n<p>Nginx Amplify Site<br \/>\n<a href=\"https:\/\/amplify.nginx.com\/\">https:\/\/amplify.nginx.com\/<\/a><\/p>\n<p>After verifying the account, connect to your server through ssh where you have installed nginx. Then you are good to download the amplify agent script with the link given below.<\/p>\n<pre>$ wget <a href=\"https:\/\/github.com\/nginxinc\/nginx-amplify-agent\/raw\/master\/packages\/install.sh\">https:\/\/github.com\/nginxinc\/nginx-amplify-agent\/raw\/master\/packages\/install.sh<\/a><\/pre>\n<p>Or you can also download with curl command as follows:<\/p>\n<pre>$ curl -L -O <a href=\"https:\/\/github.com\/nginxinc\/nginx-amplify-agent\/raw\/master\/packages\/install.sh\">https:\/\/github.com\/nginxinc\/nginx-amplify-agent\/raw\/master\/packages\/install.sh<\/a><\/pre>\n<h2>Installing the Amplify Agent Script<\/h2>\n<p>Now run the below command with the sudo user to install the amplify agent script on the server.<\/p>\n<pre>$ sudo API_KEY='4ddc68e6077eaa0b08b5c1ef50c760e0' sh .\/install.sh<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"840\" height=\"462\" class=\"wp-image-12592\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-604.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-604.png 840w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-604-300x165.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-604-768x422.png 768w\" sizes=\"auto, (max-width: 840px) 100vw, 840px\" \/><\/p>\n<p>Note: API_KEY might be different in your case.<\/p>\n<p>You can click on continue on the amplify site after the successful installation of nginx-amplify-agent package. See the picture below for the details.<\/p>\n<h2>Stub_status Configuration for Nginx<\/h2>\n<p>Next, add the stub_status configuration file on nginx Which builds the key graphs for Nginx.<\/p>\n<p>First, navigate to the nginx directory with the following command.<\/p>\n<pre>$ cd \/etc\/nginx<\/pre>\n<p>Now add the stub_status configuration file for Nginx as below command.<\/p>\n<pre>$ sudo vim conf.d\/sub_status.conf<\/pre>\n<p>Add the configuration as shown on the screenshot below.<\/p>\n<pre>server {\r\n\r\nlisten 127.0.0.1:80;\r\n\r\nserver_name 127.0.0.1;\r\n\r\nlocation \/nginx_status {\r\n\r\nstub_status on;\r\n\r\nallow 127.0.0.1;\r\n\r\ndeny all;\r\n\r\n}\r\n\r\n}<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"463\" height=\"192\" class=\"wp-image-12593\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-605.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-605.png 463w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-605-300x124.png 300w\" sizes=\"auto, (max-width: 463px) 100vw, 463px\" \/><\/p>\n<p>Now to activate the configuration module stub_status, restart the Nginx service with the following command.<\/p>\n<pre>$ sudo systemctl restart nginx.service<\/pre>\n<p>You can click on continue on the amplify site after the successful configuration of stub_status module.<\/p>\n<h2>Setup Additional Nginx metrics<\/h2>\n<p>Let\u2019s set up additional Nginx metrics for better monitoring. You can add and set up the files like access_log, error_log and log_format. Edit your main nginx configuration file \/etc\/nginx\/nginx.conf file as follows.<\/p>\n<h3>Access_log and error_log<\/h3>\n<pre>$ sudo vim nginx.conf<\/pre>\n<pre>access_log \/var\/log\/nginx\/access.log main_ext;\r\n\r\nerror_log \/var\/log\/nginx\/error.log warn;<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"457\" height=\"57\" class=\"wp-image-12594\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-606.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-606.png 457w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-606-300x37.png 300w\" sizes=\"auto, (max-width: 457px) 100vw, 457px\" \/><\/p>\n<pre>Log_format<\/pre>\n<p>Add the configurations as shown on below screenshot for the log_format<\/p>\n<pre>log_format main_ext '$remote_addr - $remote_user [$time_local] \"$request\" '\r\n\r\n'$status $body_bytes_sent \"$http_referer\" '\r\n\r\n'\"$http_user_agent\" \"$http_x_forwarded_for\" '\r\n\r\n'\"$host\" sn=\"$server_name\" ' 'rt=$request_time '\r\n\r\n'ua=\"$upstream_addr\" us=\"$upstream_status\" '\r\n\r\n'ut=\"$upstream_response_time\" ul=\"$upstream_response_length\" '\r\n\r\n'cs=$upstream_cache_status' ;<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"791\" height=\"142\" class=\"wp-image-12595\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-607.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-607.png 791w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-607-300x54.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-607-768x138.png 768w\" sizes=\"auto, (max-width: 791px) 100vw, 791px\" \/><\/p>\n<p>Restart the Nginx server with the following command.<\/p>\n<pre>$ sudo systemctl restart nginx.service<\/pre>\n<h3>Amplify Agent for monitoring Nginx web server<\/h3>\n<p>Now, you can monitor Nginx web server with the Amplify Agent by watching the results and reports on the amplify dashboard Web UI portal as the screenshot below.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1261\" height=\"790\" class=\"wp-image-12596\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-608.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-608.png 1261w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-608-300x188.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-608-1024x642.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-608-768x481.png 768w\" sizes=\"auto, (max-width: 1261px) 100vw, 1261px\" \/><\/p>\n<p>For a more clear view of the reports on Nginx web server, go through the Overview section as follows screenshot.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1240\" height=\"751\" class=\"wp-image-12597\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-609.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-609.png 1240w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-609-300x182.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-609-1024x620.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-609-768x465.png 768w\" sizes=\"auto, (max-width: 1240px) 100vw, 1240px\" \/><\/p>\n<h2>Conclusion<\/h2>\n<p>Amplify is an important monitoring tool having a significant role for the better handling of the server that is based on a SaaS monitoring platform. Its support for Nginx Plus, php-fpm and other components of the underlying operating system is a great advantage for the Nginx users to monitor all the involved systems through a WEB UI portal. Thank you!<\/p>","protected":false},"excerpt":{"rendered":"<p>As Nginx is one of the most widely used open source web servers, it is better to monitor such servers. Amplify is one such capable monitoring tool which&hellip;<\/p>","protected":false},"author":1,"featured_media":12779,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,4,5,83,165,2],"tags":[149,726,310],"class_list":["post-12591","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-debian","category-mint","category-opensuse","category-red-hat","category-ubuntu","tag-nginx","tag-proxy-server","tag-web-servers"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/12591","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=12591"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/12591\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/12779"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=12591"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=12591"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=12591"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}