我希望能夠在由普通用戶啟動時在連接埠 8080 上運行 nginx 伺服器,在由 root 啟動時在連接埠 80 上運行。如何在設定檔中或使用 bash 腳本對此進行參數化?
答案1
如果您想透過命令列提供設定文件,請查看命令列幫助:
$ /usr/sbin/nginx -h
nginx version: nginx/1.2.1
Usage: nginx [-?hvVtq] [-s signal] [-c filename] [-p prefix] [-g directives]
Options:
-?,-h : this help
-v : show version and exit
-V : show version and configure options then exit
-t : test configuration and exit
-q : suppress non-error messages during configuration testing
-s signal : send signal to a master process: stop, quit, reopen, reload
-p prefix : set prefix path (default: /etc/nginx/)
-c filename : set configuration file (default: /etc/nginx/nginx.conf)
-g directives : set global directives out of configuration file
所以也許您正在尋找-c
這裡的選項。