proxy
Switches the web server you are using to "nginx reverse proxy + production nginx + staging nginx". It will also restart the service.
For details on the differences between Web servers, please refer to the KUSANAGI Security Edition Web Server Configurations.
You can specify different versions of NGINX for the nginx reverse proxy, the production nginx, and the staging nginx.
If no critical errors are detected on the staging nginx during the staging period, the version of NGINX of the reverse proxy nginx and the production nginx will be automatically upgraded to the version of NGINX of the staging nginx.
Additionally, if a critical error is detected on the staging nginx during the staging period, the staging nginx will be automatically stopped and switched back to "nginx reverse proxy + nginx" with the original versions of NGINX.
The production nginx and the staging nginx are load balanced with a 5:1 weighting.
To explicitly access the staging nginx, specify X-Staging: on
in the HTTP header of the HTTP request.
Example
kusanagi proxy --use nginx127 --staging latest
kusanagi proxy --nostaging
Options
(No options)
If you are using "nginx reverse proxy + httpd", it will switch to "nginx reverse proxy + production nginx + staging nginx".
If "nginx" is already running, "nginx reverse proxy + production nginx + staging nginx" will restart.
NGINX Version for Reverse Proxy
[--use {installed | nginx129 | nginx128 | nginx127 | nginx126}]
Default: installed
Specifies the version of NGINX to be used for reverse proxy. When one of the following NGINX is specified, it will start up.
If multiple versions of NGINX is already running, this option is mandatory.
"--use" cannot be specified with "--reload", "--test" or "--status" at the same time.
- --use installed: NGINX currently installed
- --use nginx129 : NGINX 1.29
- --use nginx128 : NGINX 1.28
- --use nginx127 : NGINX 1.27
- --use nginx126 : NGINX 1.26
NGINX Version for Production
[--production {nginx129 | nginx128 | nginx127 | nginx126 | latest}]
Default: same version NGINX as reverse proxy
Specifies the version of NGINX to be used for production. When one of the following NGINX is specified, it will start up.
"--production" cannot be specified with "--reload", "--test" or "--status" at the same time.
- --production nginx129 : NGINX 1.29
- --production nginx128 : NGINX 1.28
- --production nginx127 : NGINX 1.27
- --production nginx126 : NGINX 1.26
- --production latest: latest version of NGINX
NGINX Version for Staging
[--staging {nginx129 | nginx128 | nginx127 | nginx126 | latest} | --nostaging | --no-staging]
Default: none (do not change NGINX version of the staging nginx)
Specifies the version of NGINX to be used for staging. When one of the following NGINX is specified, it will start up.
If "--nostaging" or "--no-staging" are specified, the staging nginx will be stopped.
If none of "--staging", "--nostaging" or "--no-staging" is specified, it will not change the staging nginx. If the staging nginx is already running, the version of NGINX will be same as it is. If the staging nginx is already stoppped, the staging nginx will still be stopped.
"--staging", "--nostaging" and "--no-staging" cannot be specified with "--reload", "--test" or "--status" at the same time.
"--staging", "--nostaging" and "--no-staging" cannot be specified at the same time.
- --staging nginx129 : NGINX 1.29
- --staging nginx128 : NGINX 1.28
- --staging nginx127 : NGINX 1.27
- --staging nginx126 : NGINX 1.26
- --staging latest: latest version of NGINX
Staging Period
[--staging-days DAYS]
Default: 7 days
Specifies the staging period in days.
This option only takes effect when specified together with “--staging”.
Reloading Configuration
[--reload]
Reloads configuration without disconnecting the session.
"--reload" cannot be specified with "--use", "--production", "--staging", "--nostaging", "--no-staging", "--test" or "--status" at the same time.
Checking Configuration File
[--test]
Checks the configuration files only.
"--test" cannot be specified with "--use", "--production", "--staging", "--nostaging", "--no-staging", "--reload" or "--status" at the same time.
Displaying Status
[--status]
Displays status of NGINX.
"--status" cannot be specified with "--use", "--production", "--staging", "--nostaging", "--no-staging", "--reload" or "--test" at the same time.
Output
# kusanagi proxy --use nginx127 --staging latest
nginx: the configuration file /etc/opt/kusanagi/nginx127/nginx-proxy.conf syntax is ok
nginx: configuration file /etc/opt/kusanagi/nginx127/nginx-proxy.conf test is successful
nginx: the configuration file /etc/opt/kusanagi/nginx127/nginx-production.conf syntax is ok
nginx: configuration file /etc/opt/kusanagi/nginx127/nginx-production.conf test is successful
nginx: the configuration file /etc/opt/kusanagi/nginx129/nginx-staging.conf syntax is ok
nginx: configuration file /etc/opt/kusanagi/nginx129/nginx-staging.conf test is successful
Created symlink /etc/systemd/system/multi-user.target.wants/nginx129@staging.service -> /usr/lib/systemd/system/nginx129@.service.
proxy completed.