Bootstrap FreeKB - OpenResty - Create Nginx configuration file
OpenResty - Create Nginx configuration file

Updated:   |  OpenResty articles

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



Comments


Add a Comment


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