Built on popular Nginx web server Openresty comes with additional plugins to make advanced tasks easier. You can use Openresty as drop in replacement for Nginx.
Most used feature of Openresty is the the built in Lua plugin that helps in writing Lua web app directly inside the web server without any need on installing other software. As Lua is built into the web server it makes it faster.
You can always download the source and compile it yourself but that is cumbersome and makes updating Openresty later on difficult.
For this guide, I will be using the prebuilt binaries provided by the Openresty repository.
Lets get Started
Step 1 : Import GPG Key:
GPG key helps in verifying the authenticity of the package. Run following command to get the GPG key from the official Openresty server and add in to your server.
wget -qO - https://openresty.org/package/pubkey.gpg | sudo apt-key add -
Step 2 : Add Openresty repository:
We need to be sure that ‘apt-add-repository’ command is available in our server. Run below command and it will install the required packages if not available.
sudo apt-get -y install software-properties-common
Now to add the repository use below command. It will detect the version of Ubuntu running on your server and add the appropriate repository.
sudo add-apt-repository -y "deb http://openresty.org/package/ubuntu $(lsb_release -sc) main"
Step 3 : Install Openresty
Update the apt index first
sudo apt-get update
Now run below command to download and install Openresty web server
sudo apt-get install openresty
If no error occurs you will have Openresty web server successfully installed and running on your server.
Visit your server’s IP address and you will be presented with a page like this
If you face any problem please comment below and we will try to solve it together.