Tag archive for: HTTP

How to setup Codiad Web IDE on your Raspberry Pi 3 with Raspbian Stretch Lite, Nginx and PHP

A Web IDE server allows you to code wherever you are and whenever you want from any device through a web browser. A Raspberry Pi 3 board is a good gift for programmers and if you happen to receive one or bought one and do not know what to do with it, you may want to setup Codiad Web IDE on it to help you code while you are on the move.

Read on to find out how to setup Codiad Web IDE on your Raspberry Pi 3 with Raspbian Stretch Lite, Nginx and PHP as the LEMP stack.

Configuring Nginx for PHP web applications

Nginx and PHP FastCGI Process Manager (FPM) are often used side by side for PHP applications. In such a setting, Nginx will be the first point of contact for incoming HTTP requests, acting as a reverse proxy server for the PHP FastCGI Process Manager.

The PHP FastCGI Process Manager then interprets the HTTP requests that it receives from Nginx and runs the PHP scripts for generating the corresponding HTTP responses for Nginx to return back to the HTTP client.

This post discusses a set of configurations that you can use for configuring Nginx for your PHP web applications.

Configuring Nginx to serve files for a static website

In the world of HTTP, static files are content hosted on a web server that does not change. Some examples of static files include images, CSS files, JavaScript files and HTML files.

Although it is not too hard to implement a dynamic website through a content management framework like WordPress on your own server, there are cases where it makes more sense to just host a couple of static files to realise your website.

Nginx is an excellent web server for serving static websites. If you already have Nginx running on a Raspberry Pi 3 or any other kinds of server, you may want to configure it to serve files for your static website.

Building a reverse proxy server with Nginx, Certbot, Raspbian Stretch Lite and Raspberry Pi 3

The Nginx reverse proxy server runs well on Raspberry Pi 3 and you can use it behind a router to route HTTP traffic to upstream web applications.

A Raspberry Pi 3 reverse proxy server is a very useful appliance to help us host multiple websites from home.

Some examples of web applications that you may want to host at home includes:

This post discusses how you can build a reverse proxy server with nginx, Certbot, Raspbian Stretch Lite and Raspberry Pi 3 to proxy HTTP traffic directed at applications on your home network.

Understanding the difference between the root and alias directives in Nginx

Nginx is a web server that is good for serving as a reverse proxy server, load balancer or HTTP cache.

One of the most important task in configuring Nginx to proxy HTTP / HTTPS traffic is telling Nginx where to look for files that it needs for serving HTTP / HTTPS requests.

This posts discusses the root and alias directives that we can use in Nginx configuration files for mapping a url from a HTTP request to a file on the server file system.

How to send an HTTP request to a HTTP Basic Authentication endpoint in Java without using any external libraries

One common task for Java developers is to write codes that communicate with API endpoints. Chances are these endpoints could use HTTP Basic Authentication for authenticating the HTTP request sender.

Although there are good libraries to help us craft and send HTTP requests to a web server in Java, I prefer to use the Java core library so as to keep my Java program lightweight.

Referencing my earlier post on how to construct a HTTP request to an endpoint with HTTP basic authentication, this post documents how to send an HTTP request to a HTTP Basic Authentication endpoint in Java without using any external libraries.

How to construct a HTTP request to an endpoint with HTTP Basic Authentication

The HTTP basic authentication is a mechanism commonly used by web servers to authenticate the sender of a HTTP request. Such a mechanism is usually used to guard server endpoints that are meant to be accessed programmatically.

Almost every new project that I got my hands on required me to create client side coding for accessing server endpoints that use HTTP basic authentication for authenticating the HTTP request sender.

To have a quick reference on how to construct a HTTP request to an endpoint with HTTP basic authentication, I created this post to as a documentation. The steps are agnostic to any programming languages.

The reverse proxy server

With the proliferation of cloud computing and single board computers, the term – reverse proxy server, becomes a frequent mention in technical specifications that we may encounter as a developer or system implementation consultant.

Finding myself having to reiterate my understanding of the reverse proxy server, I reckoned that I should document what I know about the reverse proxy server so that I have a place where people can reference when they are lost with the topic of reverse proxy server.

How to upload a file via a HTTP multipart request in Java without using any external libraries

There was this situation when there was a need for my applet to send some log files (generated by some desktop application) on the remote clients.

To keep my applet lean, I chose to implement this file upload function by sending a HTTP multipart request when my applet loads on the remote client’s browser. Policies were in place to ensure that my applet was able to read the log files and send them back to a web server which will collect the log files.

This post documents how I can upload a file by sending a HTTP multipart request in Java without using any external libraries. For the sake of brevity, I used the server endpoint that I had discussed earlier to accept the file from the codes that will be mentioned in this post.