Nginx-Variablenportnummer

Nginx-Variablenportnummer

Ich möchte einen Nginx-Server auf Port 8080 ausführen können, wenn er von einem normalen Benutzer gestartet wird, und auf Port 80, wenn er von Root gestartet wird. Wie kann dies in der Konfigurationsdatei oder mithilfe eines Bash-Skripts parametrisiert werden?

Antwort1

Und wenn Sie Konfigurationsdateien über die Befehlszeile bereitstellen möchten, sehen Sie sich die Befehlszeilenhilfe an:

$ /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

Vielleicht suchen Sie -chier nach dieser Option.

verwandte Informationen