Apache + Nginx in ispmanager
How Apache + Nginx work
Apache and Nginx can work both independently and in conjunction with each other.
If Apache is used in conjunction with Nginx, Nginx handles requests for static content and acts as a reverse proxy, forwarding dynamic requests to Apache. Apache acts as a backend server, processing requests for dynamic content using the handlers:
- PHP in one of the modes:
- Python in the CGI mode
If one of the Nginx-only handlers or handler modes is selected for a site, Apache will not be started for that site.
Apache + Nginx request processing
When using Apache + Nginx, requests to sites are processed in the following way:
- Nginx receives and analyzes the request from the client.
- Nginx processes the request:
- If static content is requested, the file is immediately sent to the client.
- If dynamic content is requested, the request is passed on to Apache.
- Apache passes the request to the handler.
- The handler executes the code and sends the generated file to Apache.
- Apache sends the file to Nginx.
- Nginx sends the requested page to the client and terminates the connection with the client.
Changes after Apache + Nginx installation
Switching web servers may cause website malfunctions.
- The default Apache version from the OS repository and the Nginx version from ispmanager are installed.
- Configuration files are prepared. For each site on the server for which Apache and Nginx are running, Apache and Nginx configuration files are generated, and a virtual host is created.
- If Apache and PHP-FPM modules were activated during installation, the LSAPI module is removed for all installed alternative PHP versions and the Apache and PHP-FPM modules are installed instead.
- When switching from Apache or Nginx, the access and default settings of existing users do not change. When switching from OpenLiteSpeed, all existing users are granted permission to use PHP in CGI mode if they were previously allowed to use PHP in LSAPI mode. The default PHP mode is reset. User settings that require LiteSpeed or OpenLiteSpeed are reset.
- All existing sites are converted to work with Apache and Nginx. When switching from Apache or Nginx, the settings of existing sites do not change. When switching from OpenLiteSpeed, for all existing sites with a PHP handler, PHP in CGI mode is installed. Site settings that require LiteSpeed or OpenLiteSpeed are reset.
Apache + Nginx logging
Viewing logs is available to accounts with superuser rights.
Apache + Nginx global logs
Apache | Nginx | |
---|---|---|
access log | Debian-based operating systems: RHEL-based operating systems: | /var/log/nginx/access.log |
error log | Debian-based operating systems: RHEL-based operating systems: | /var/log/nginx/error.log |
Site logs
Logs are available if they are enabled for the site.
/var/www/httpd-logs/DOMAIN.access.log
— access log/var/www/httpd-logs/DOMAIN.error.log
— error log
Viewing logs is also available in the WWW request logs section.