OpenResty - Create Nginx configuration file

This assumes you have installed OpenResty on a Linux system.

Create directories that will contain your Nginx files.

mkdir --parents /opt/openresty/conf
mkdir --parents /opt/openresty/logs

 

Create the Nginx configuration file.

touch /opt/openresty/conf/nginx.conf

 

Add the following to nginx.conf.

worker_processes  1;
error_log logs/error.log;
events {
    worker_connections 1024;
}
http {
    server {
        listen 8080;
        location / {
            default_type text/html;
            content_by_lua_block {
                ngx.say("<p>Hello World</p>")
            }
        }
    }
}

 

Start the Nginx web server.

/usr/local/openresty/nginx/sbin/nginx -c /opt/openresty/conf/nginx.conf

 

In a web browser, navigate to the hostname of your system running OpenResty on port 8080, and Hello World should be displayed.

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee

Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.





Please enter 0babf in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |