Search code examples
nginxopenresty

why could not delete the nginx config when using openresty


I am using openresty openresty/1.21.4.1 as the web server,today I copied the nginx config from /etc/nginx/ to /usr/local/openresty/nginx/. Then I delete the config of nginx /etc/nginx/, but the web server could not access anymore. I using this command to show the openresty config:

[root@k8smasterone nginx]# /usr/local/openresty/bin/openresty -t
nginx: the configuration file /usr/local/openresty/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/openresty/nginx/conf/nginx.conf test is successful

does the openresty using the nginx config? is it possible to make openresty using config from /usr/local/openresty/nginx/conf? where should I put the nginx config to?


Solution

  • Yes, bin/openresty is an alias to the Nginx command. You can point to your config with -p or -c flags:

    $ /usr/local/openresty/bin/openresty -h
    
    Options:
      -p prefix     : set prefix path (default: /usr/local/openresty)
      -c filename   : set configuration file (default: PREFIX/nginx.conf)
      ...