Код: Выделить всё
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Код: Выделить всё
ServerName test.example.com
Redirect 301 / "https://test.example.com"
ServerName test.example.com
# logs
ErrorLog ${APACHE_LOG_DIR}/test.example.com.error.log
CustomLog ${APACHE_LOG_DIR}/test.example.com.access.log combined
# process
WSGIDaemonProcess test.example.com python-path=/home/test.example.com python-home=/home/test.example.com/.venv display-name=%{GROUP}
WSGIProcessGroup test.example.com
WSGIScriptAlias / /home/test.example.com/config/wsgi.py
# alias
Alias /static /home/test.example.com/tmp/static
Alias /media /home/test.example.com/tmp/media
# dirs
Require all granted
ExpiresActive On
ExpiresDefault "access plus 1 year"
Require all granted
ExpiresActive On
ExpiresDefault "access plus 1 year"
Require all granted
# certbot
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/test.example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/test.example.com/privkey.pem
Однако, если я получаю доступ, например, к 123.123.123.123/abc/def, он пытается получить доступ к моему проекту Django.
Почему он пытается это сделать и как мне этого избежать?
Если я установлю глобальный ServerName работает и просто возвращает NotFound на IP/abc/def, но я не понимаю почему. Я думал, что он выбирает наиболее конкретный VirtualHost, и если он недоступен, только первый, который, как я думал, будет использоваться по умолчанию в случае IP/abc/def.
Подробнее здесь: https://stackoverflow.com/questions/792 ... ost-to-use