HOME » Documents » KUSANAGI Web Server Configurations

KUSANAGI Web Server Configurations

In KUSANAGI, Nginx and Apache HTTP Server can be selected for Web Server.
Also, it is possible to combine them for the Web server configuration.
In this document, each Web server configurations are described.

  1. "nginx" mode
  2. "httpd" mode
  3. "nginx reverse proxy + httpd" mode

Differences between Web Server Configurations

The differences of available features in each Web server configurations are shown in the table.
For the detail of each features, refer the document below or refer the corresponding kusanagi command.

Feature1. "nginx" mode2. "httpd" mode3. "nginx reverse proxy + httpd" mode
bcacheAvailable in WordPress profilesAvailable in WordPress profilesAvailable in WordPress profiles
fcacheAvailable in all profilesUnavailableAvailable in all profiles1
ratelimitAvailable in all profilesUnavailableAvailable in all profiles
.htaccess fileUnavailableAvailable in all profilesAvailable in all profiles
HTTP/3Available in all profilesUnavailableAvailable in all profiles
WAFNAXSI is usedmod_security is usedmod_security is used

Specify and Change Web Server Configuration

Initialize Web Server Configuration

Specifying Web Server Configuration can be done with kusanagi init command and corresponding kusanagi commands.

3. "nginx reverse proxy + httpd" mode cannot be specified by kusanagi init command. After initialized with 1. "nginx" mode, execute corresponding kusanagi command to change Web server configuration.

kusanagi command1. "nginx" mode2. "httpd" mode3. "nginx reverse proxy + httpd" mode
kusanagi init command--nginxXXX option
(XXX will contain the version)
--httpdXX option
(XX will contain the version)
(Cannot be specified with kusanagi init command)
Corresponding kusanagi commandkusanagi nginx commandkusanagi httpd commandkusanagi httpd-behind-nginx command

Change and Restart Web Server Configuration

When running in one Web server configuration, you can change the Web server configuration by executing the kusanagi command corresponding to another Web server configuration. For example, when the web server configuration is running in 1. "nginx" mode, executing the kusanagi httpd command will change it to 2. "httpd" mode.

When a Web server configuration is running, executing the corresponding kusanagi command will restart each web server while maintaining that configuration. For example, if the Web server configuration is running in 1. "nginx" mode, executing kusanagi nginx will restart nginx. In configurations where multiple Web servers are running, such as 3. "nginx reverse proxy + httpd" mode, all Web servers will be restarted.

kusanagi command1. "nginx" mode2. "httpd" mode3. "nginx reverse proxy + httpd" mode
kusanagi nginx commandRestartChange to 1. "nginx" modeChange to 1. "nginx" mode
kusanagi httpd commandChange to 2. "httpd" modeRestartChange to 2. "httpd" mode
kusanagi httpd-behind-nginx commandChange to 3. "nginx reverse proxy + httpd" modeChange to 3. "nginx reverse proxy + httpd" modeRestart

For each kusanagi command, when restarting the Web server or modifying its configuration, the system tests the configuration files and performs the restart or modification only if no errors are found. If errors are detected in the configuration files, the system does not perform the restart or modification and continues to operate the Web server with its current configuration.

Reload Web Server Configuration

You can reload the Web server configuration files by executing each kusanagi command with the --reload option. In configurations where multiple Web servers operate, such as 3. “nginx reverse proxy + httpd" mode, all Web server configuration files are reloaded. During this process, the configuration files are tested, and reloading occurs only if no errors are found. If errors are detected in the configuration files, reloading is not performed, and the current Web server configuration continues unchanged.

Test Configuration Files of Web Server Configuration

You can test the Web server configuration files by executing each kusanagi command with the --test option. In configurations where multiple Web servers operate, such as 3. “nginx reverse proxy + httpd" mode, all Web server configuration files are tested.

1. "nginx" Mode

This is a simple mode for using Nginx as a standalone web server.

Nginx accepts requests on ports 80/443 and handles PHP execution via php-fpm.
CGI (perl) similarly accepts requests and executes them via fcgiwrap.
The WordPress profile supports bcache. Additionally, all profiles support fcache, ratelimit, and HTTP/3.

The Nginx service name is nginxXXX (where XXX is the version). Note that in versions prior to KUSANAGI 9.5.0, it is fixed as nginx.

Verify Status

kusanagi status command displays the following.

*** (active) nginx : nginx129 ***
* nginx129.service - The NGINX HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx129.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2025-08-06 10:24:07 JST; 6 days ago

Location of Logs

  • /home/kusanagi/PROFILE/log/nginx
    • http is logged to access.log/error.log.
    • https is loggedf to ssl_access.log/ssl_error.log.
  • /var/opt/kusanagi/log/nginx

Location of Configuration Files

  • /etc/opt/kusanagi/nginx/conf.d

2. "httpd" Mode

This mode uses the Apache HTTP Server as a standalone web server.
Use this when Apache HTTP Server-specific features, such as .htaccess files, are required.

The Apache HTTP Server accepts requests on ports 80/443, and PHP execution is handled by php-fpm. Note that KUSANAGI does not use mod_php.
CGI (perl) similarly accepts requests, with execution handled by fcgiwrap.
The WordPress profile supports bcache. Note that fcache, ratelimit, and HTTP/3 are unavailable in all profiles.

The Apache HTTP Server service name is httpd (fixed).

Verify Status

kusanagi status command displays the following.

*** (active) httpd : httpd24 ***
* httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2025-08-06 10:24:07 JST; 6 days ago

Location of Logs

  • /home/kusanagi/PROFILE/log/httpd
    • http is logged to access.log/error.log.
    • https is logged to ssl_access.log/ssl_error.log.
  • /var/opt/kusanagi/log/httpd

Location of Configuration Files

  • /etc/opt/kusanagi/httpd/conf.d

3. "nginx reverse proxy + httpd" Mode

This mode operates with Nginx as a reverse proxy, running Apache HTTP Server behind it.
It combines fcache, supported only by Nginx, with Apache HTTP Server-specific features like .htaccess files.

Nginx accepts requests on ports 80/443 and reverse proxies them to Apache HTTP Server.
The Apache HTTP Server accepts requests on port 8000 and executes PHP processing via php-fpm.
CGI (perl) similarly accepts requests and executes processing via fcgiwrap.
The WordPress profile can utilize bcache. Additionally, fcache, ratelimit, and HTTP/3 are available in all profiles.

There is a note regarding fcache: If you are restricting access based on IP addresses or similar in your .htaccess file, please either disable fcache or configure it not to cache. This restriction is the same as with typical CDNs.

The Nginx service name is nginxXXX@with_httpd (XXX is the version number).
The Apache HTTP Server service name is httpd@with_nginx (fixed).

Verify Status

kusanagi status command displays the following.

*** (active) nginx : nginx129 ***
* nginx129@with_httpd.service - The NGINX HTTP and reverse proxy server (with_httpd)
Loaded: loaded (/usr/lib/systemd/system/nginx129@.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2025-08-06 10:24:07 JST; 6 days ago

*** (active) httpd : httpd24 ***
* httpd@with_nginx.service - The Apache HTTP Server (with_nginx)
Loaded: loaded (/usr/lib/systemd/system/httpd@.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2025-08-06 10:24:07 JST; 6 days ago

Location of Logs

  • nginx reverse proxy
    • /home/kusanagi/PROFILE/log/nginx
      • http is logged to access.log/error.log.
      • https is logged to ssl_access.log/ssl_error.log.
    • /var/opt/kusanagi/log/nginx
  • httpd
    • /home/kusanagi/PROFILE/log/httpd
      • Regardress of http/https, all logged to access.log/error.log.
    • /var/opt/kusanagi/log/httpd

Location of Configuration Files

  • nginx
    • /etc/opt/kusanagi/nginx/conf.with_httpd.d
      • It is automatically generated from the configuration file in /etc/opt/kusanagi/nginx/conf.d. Therefore, please do not update it directly.
  • httpd
    • /etc/opt/kusanagi/httpd/conf.with_nginx.d
      • It is automatically generated from the configuration file in /etc/opt/kusanagi/httpd/conf.d. Therefore, please do not update it directly.
  1. If you are restricting access based on IP addresses or similar criteria in your .htaccess file, please configure it to either disable fcache or prevent caching. ↩︎
KUSANAGI
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.