Creating Aliases for a Website
To add an alias (additional domain) to your website in the Bitrix7 system, you will need to make corresponding changes in the Nginx and Apache configuration files, and then restart the web servers.
Making Changes
- For Nginx
Configuration files are available at the following paths:
/etc/nginx/bx/site_enabled/bx_ext_site_name.conf
/etc/nginx/bx/site_available/bx_ext_ssl_site_name.conf
You need to open each of these files and find the line with the server_name mydomain.com directive, where mydomain.com is the primary domain name of your site.
Simply add the alias, separating it with a space after the already specified domain, for example:
server_name mydomain.com mydomain2.com;
- For Apache
The configuration file is available at the following path:
/etc/httpd/bx/conf/bx_ext_site_name.conf
Open the file and find the line with the ServerAlias www.mydomain.com directive, where mydomain.com is the primary domain name of your site.
Simply add the alias, separating it with a space after the specified domain, for example:
ServerAlias www.mydomain.com mydomain2.com;
Verification
After making changes in the configuration files, it's essential to ensure that they have been applied correctly.
To do this, you can execute the following commands:
- For Nginx
nginx -t
If all changes have been applied successfully, you will see the following result of the command:
nginx: configuration file /etc/nginx/nginx.conf test is successful
- For Apache
apachectl -t
After executing this command, you should see the following message:
Syntax OK
Applying Changes
To apply the changes made, you need to restart the web servers.
To do this, execute the following commands sequentially:
- For Nginx
nginx -s reload
- For Apache
apachectl graceful