Nginx configuration

Lesson 31 out of 78

Execute Nginx configuration.

  • Work site directory - /var/www/html/bx-site.
  • Web environment user - nginx, apache group.

Server nginx configuration:

/etc/nginx/nginx.conf                                       # main config file
            |_conf.d/upstreams.conf                         # configuration for upstream servers: apache && push-server
            |_conf.d/maps-composite_settings.conf           # variables used for cache
            |_conf.d/maps.conf                              # additional variables
            |_conf.d/http-add_header.conf                   # CORS headers
            |_sites-available/*.conf                        # connect sites
                              |_default.conf                # default site (configure port 80 only)
                                    |_conf.d/bx_temp.conf   # BX_TEMPORARY_FILES_DIRECTORY configuration
                                    |_conf.d/bitrix.conf    # default site configuration
                              |_rtc.conf                    # query proxying at push-server (publication)

Default site configuration:

conf.d/bitrix.conf                                          # main blocks with cache enabled by default in files
        |_conf.d/bitrix_general.conf                        # sending statistics, quick transfer for external storages and etc.
                |_conf.d/errors.conf                        # error processing
                |_conf.d/im_subscrider.conf                 # query proxying to push-server (receiving)
                |_conf.d/bitrix_block.conf                  # blocking by default

Configuration is sourced from virtual appliance and can be deemed excessive, but in effect supports the same options as the virtual appliance.

All configuration files can be downloaded in archive. Config files for Nginx are located in the folder as follows: sles15/nginx.

Place them in the directory /etc/nginx/.

The service uses names for proxying to specific services:

  • httpd – query proxying to apache;
  • push – query proxying to push-server.

For configuration to be operational, write the services in local addresses. When services are located on another host, indicate the correct address here:

echo " push httpd" >> /etc/hosts

Start the service:

systemctl --now enable nginx

Add rules for firewalld:

firewall-cmd --zone=public --add-service=https --permanent
firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --reload