Hello! I’m stuck here, any ideas what’s wrong?
Have made “sudo apachectl configtest” or “apachectl configtest” several times, even have tried to reset lab.
Have made “sudo apachectl configtest” or “apachectl configtest” several times, even have tried to reset lab.
Hi @severyan
Exactly what change did you make to the configuration? I’ve just tried it and it works for me.
sudo vi /etc/httpd/conf/httpd.conf
<Directory “/var/www/html/admin/”>
Require ip 127.0.0.1
sudo apachectl configtest
sudo systemctl restart httpd
I don’t see the closing block for the directory in yours above, but I assume it must be there or the config test should fail.
My solution exactly…
sudo vi /etc/httpd/conf/httpd.conf
Scroll to end of file
Change
<Directory "/var/www/html/admin/">
</Directory>
to
<Directory "/var/www/html/admin/">
Require ip 127.0.0.1
</Directory>
sudo systemctl reload httpd
reload or restart should not matter.
It’s strange editor behaviour
I’ve made the same. TWICE
After you exit vi
, check change is saved properly
sudo cat /etc/httpd/conf/httpd.conf
Last few lines of cat
output should look like this
# Supplemental configuration
#
# Load config files in the "/etc/httpd/conf.d" directory, if any.
IncludeOptional conf.d/*.conf
<Directory "/var/www/html/admin/">
Require ip 127.0.0.1
</Directory>
Ok, I made it fail.
Did you use TAB
before Require ip 127.0.01
?
The lab validation seems not to like that.
Try indenting with spaces.
I will get this checked by the engineering team.
You’re right. The problem was in using TAB
May be safer in all labs to use spaces not tabs when editing config files. You can configure vi
to insert spaces instead of tabs when pressing the TAB key, by doing this at the start of each lab.
cat <<EOF > ~/.vimrc
set nu
set ts=4
set sw=4
set et
EOF
What these do, in order:
Thnx for your assistance. At the same time TAB works perfectly in 10 task, when we are to set up authentication in httpd.conf
I have raised this with the engineering team. It may be an issue with the task validation script not recognising TAB - which it should if it is valid for httpd
Hi @severyan
Engineering team have fixed it now so TAB is scored correctly.
As a general tip, it’s a good idea to configure editors to insert spaces instead of TAB when tab key is pressed. If you find you need to edit e.g. YAML files (kubernetes, ansible etc) , YAML is very fussy about whitespace (it is part of the syntax) and fails when TAB characters are present.
Hi severyan,
where is “systemctl” ?
==> sudo systemctl reload