How do you specify the configuration file path for nginx?

To specify the path of the nginx configuration file, you can use the -c parameter when starting nginx. The specific command is as follows:

nginx -c /path/to/nginx.conf

Please replace /path/to/nginx.conf with the actual configuration file path.

One can edit the /lib/systemd/system/nginx.service file if using systemd to manage the nginx service, and add the -c parameter and configuration file path in the ExecStart field. An example is shown below:

ExecStart=/usr/sbin/nginx -c /path/to/nginx.conf

After saving the files, restart the nginx service to apply the changes.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds