Check if HTTP/2 enabled using curl

To see if a web site have HTTP/2 enabled, you can run

If you see 2, the site have HTTP/2 enabled.

Example

Here is a site with no HTTP/2

wget print content to screen

wget is used to download files. When you use wget to run cronjob, it create lot of files. To avoid this, you can replace wget command with curl.

If you want to use wget, you can use -O option, that speicify file to save. You can use -O /dev/stdout, so downloaded file content will be written to stdout.

You can use -q to hide the download progres message (quite).

-O /dev/stdout can be replaced with

Or

Example

See wget

apache-http-webserver

Redirect site from www to non-www

It is better to make web site available with one URL. Many sites work with both wwww and non-www (naked domain) urls.

Using www or non-www is personal choice. One advantage of using wwww for URL is when you have lot of sub domains. If you use non-www url, cookies set by the domain will be available to sub domains. This will increase bandwidth usage as cookie need to be sent with every request browser make to web server.

Apache

If you are using Apache web server, you can redirect wwww to non-www url by adding following code in .htaccess file

Redirect non-www to www

Nginx

If you use Nginx, it is better create a server entry for www URL, then set a redirect

If you want to use same server entry for www and non-www, add following code to nginx server entry for the web site.

Redirect www domain to non-www

If you use custom ports, use

Redirect Naked Domain to www

Related Posts

Redirect

htaccess

Squid Proxy Server allow connection to all ports

By default Squid proxy only allow out going connection to white listed ports that are used commonly. When you visit a site with non standard ports with Squid proxy, it won’t work. To fix this, edit squid configuration file

Find

Replace with

Restart squid with

Related Posts

Install Squid Proxy Server

proxy

Restart Services in Xampp Linux

You can restart services on xampp linux using

To restart, use

Here are other available options

See Auto start XAMPP on Boot

Prometheus Node Exporter on non default port

To run Prometheus Node Exporter on custom port, use

Here is systemctl service script i used

Related Posts

Prometheus

Server Monitoring

grafana dashboard

Monitor Server with Prometheus and Grafana

Prometheus is used an open source software, that can collect metrics and alerting.

You can download latest version oof Prometheus from

https://prometheus.io/download/

Create a user

Download and Install prometheus

Create a service file

Add following content

Enable prometheus to start on boot

Start prometheus

Prometheus runs on port 9090, you can access promethus at

It will look like

Prometheus have some basic graphing features, but you can’t use it for monitoring. To create dash board and monitor, you need to use grafana.

Collecting Data

Node Exporter is used to collect data from servers. All monitored servers need Node Exporter installed.

Lets create a user for Node Exporter to run

Install Node Exporter

Create a systemd service file for node exporter

Add

Enable and start Node Exporter

Node Exporter run on port 9100 and expose system metrics on url

Node Exporter

Adding Servers to Prometheus

Once Node Exporter installed on a server, you need to tell Prometheus to get data from the Node Exporter you just installed. To do this, edit Prometheus configuration file.

Add following

To monitor multiple servers, you can dd more servers in targets line. Here is an example config

https://gist.github.com/serverok/83a622e7577da36384f87fe60c9930af/raw

Restart prometheus

Grafana

Grafana is used to visualise data collected by Prometheus. You can download Grafana from

https://grafana.com/grafana/download

Grafana offers free cloud hosted version with some limitation (1 user, 5 dashboards). Free version is suitable if you are getting started and don’t want to install your own. You can signup for cloud hosted version at

https://grafana.com/get

If you decide to install your own Grafana, you can run

Enable and start grafana

If you did your own install, grafana runs on port 3000. To access, use url

Default username and passwords are “admin”. Once logged in you will be asked to set password for grafana admin user.

Before you can use Grafana, you need to set a data source and create dash board. In our case, data source is prometheus. To connect Grafana to your Prometheus insallation, go to Settings > Data Sources

Grafana Data Sources

On next page, select Prometheus

Grafana Add data source

On next page, for URL, enter http://PROMETHUS_SERVER_IP:9090, scroll down, click on “Save & Test” button. If grafana can connect to your prometheus installation, you should see success message with “Data source is working”. If not, you need to check your firewall rules.

Creating Grafana Dashboards

Grafana displays data in dash boards. You can create your own or use pre existing dash boards. You can find pre-made dash boards at

https://grafana.com/grafana/dashboards

On my grafana installation, i used dashboard

https://grafana.com/grafana/dashboards/11074

To add this dash board to your Grafana, click on the + button, then select Import. On next screen, you can enter ID for the dash board you need to import. In this case 11074. Click “Load” button to import the dash board.

Here is a dash board for one of the server

grafana dashboard

You can edit Panels in grafana dash board to see how it is created. You can create a new dash board with panel you need. This way your dashboards only show required information.

Related Posts

Server Monitoring

Prometheus Node Exporter on non default port