CORRECT TEXT
Configure a HTTP server, which can be accessed through http://station.domain40.example.com.
Please download the released page from http://ip/dir/example.html.
Answer: A
Explanation:
# yum install -y httpd
# chkconfig httpd on
# cd /var/www/html
# wget http://ip/dir/example.html
# cp example.com index.html
# vim /etc/httpd/conf/httpd.conf
NameVirtualHost 192.168.0.254:80
<VirtualHost 192.168.0.254:80>
DocumentRoot /var/www/html/
ServerName station.domain40.example.com
</VirtualHost>
yum install -y httpd
systemctl start httpd
iptables -F
cd /var/www/html
wget http://ip/dir/example.html
1. By default, the Apache service does not log through rsyslog, but keeps its own
logging. You are going to change that. To start, type yum install -y httpd to
install the Apache service.
2. After installing the Apache service, open its configuration file /etc/http/conf/
httpd.conf and add the following line to it:
ErrorLog syslog:local1
3. Type systemctl restart httpd .
4. Now create a line in the rsyslog.conf file that will send all messages that it
receives for facility local1 (which is now used by the httpd service) to the file
/var/log/httpd-error.log. To do this, include the following line:
local1.error /var/log/httpd-error.log
5. Tell rsyslogd to reload its configuration, by using systemctl restart rsyslog .
6. All Apache error messages will now be written to the httpd-error.log file.
7. From the Firefox browser, go to http://localhost. As no index.html page exists
yet, this will be written to the error log.
8. Now let’s create a snap-in file that logs debug messages to a specific file as well.
To do this, type echo ”*.debug /var/log/messages-debug” > /etc/rsyslog.d/
debug.conf .
9. Again, restart rsyslogd using systemctl restart rsyslog .
10. Use the command tail -f /var/log/messages-debug to open a trace on the
newly created file.
11. Type logger -p daemon.debug ”Daemon Debug Message”. You’ll see the
debug message passing by.
12. Use Ctrl+C to close the debug log file.
DocumentRoot parameter. This parameter specifies the default location
where the Apache web server looks for its contents.
Another important configuration parameter is the ServerRoot . This defines the
default directory where Apache will look for its configuration files.