A
A
Andrey2020-08-28 14:46:26
Apache HTTP Server
Andrey, 2020-08-28 14:46:26

apache virtual hosts configuration not applied?

Good afternoon, in the process of solving the problem with the error ""Publishing failed. Error message: Response is not a valid JSON response"" in wordpress, I began to edit the virtual host settings: /etc/apache2/sites-available/my-syte.ru. conf

<VirtualHost *:80>
ServerAdmin [email protected]
ServerName my-syte.ru
ServerAlias www.my-syte.ru
DocumentRoot /var/www/my-syte.ru
<Directory /var/www/my-syte.ru/>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =my-syte.ru [OR]
RewriteCond %{SERVER_NAME} =www.my-syte.ru
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>


at random, I realized that this file does not affect anything at all. those. I can completely comment it out or "spoil it" and everything works as usual. apply settings and restart apache, still works. the default file 000-default.conf is also commented out.

The poke method led me to the file: nano /etc/apache2/apache2.conf
in which I changed the entry:
<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

on the
<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>


My problem was solved, but the unpleasant realization that something was wrong with virtual hosts remained.
The /etc/apache2/apache2.conf file contains the following lines:

# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet


Maybe I'm not checking the virtual host action correctly?
Or is there something wrong with my settings?

site directory: /var/www/my-syte.ru/

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Barbolin, 2020-08-28
@Andryxans

/etc/apache2/sites-available - available configs
/etc/apache2/sites-enable - enabled configs
To enable the config
sudo a2ensite my-
syte.ru.conf in /etc/apache2/sites-available.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question