How to specify the configuration file when starting nginx?

When starting Nginx, you can specify the configuration file to use by using the `-c` parameter. For example, to specify using `/etc/nginx/nginx.conf` file as the configuration file to start Nginx, you can execute the following command:

nginx -c /etc/nginx/nginx.conf

Additionally, you can use the `-g` parameter to specify global configuration directives. For example, to set a global `worker_processes` value to 2 at startup, you can execute the following command:

nginx -g "worker_processes 2;"

Please make sure you have the appropriate permissions when specifying a configuration file or global configuration.

bannerAds