wk2 apache Flashcards

1
Q

To find the port that Apache is listening on, you should first check …

A

“Apache non-SSL IP/port” and “ Apache SSL Port” options in WHM Home&raquo_space; Server Configuration&raquo_space; Tweak Settings.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

SSP (a script that runs) will tell you if Apache is listening on an alternate port. If neither tweak settings nor SSP can find the alternative port, then what?

A

use lsof or netstat

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the two ways apache can extend its basic functionality

A

It can either use compiled-in extra modules, or it can hand tasks off to external programs using the Common Gateway Interface (CGI).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How are compiled-in modules run?

A

Compiled in modules are run inside Apache as the Apache user (usually the user “nobody”) and can be configured using the Apache configuration files (including .htaccess files).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How to see what modules are installed?

A

httpd -M

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Give an example of a module used to extend basic php functionality

A

An example of a module used to extend basic Apache functionality is when PHP is compiled in with Apache as a dynamic shared object (when you use the DSO handler for PHP).

Other examples include items that we think of as being part of Apache, like mod_userdir and helper extensions like mod_speling.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

When is the CGI (Common Gateway Interface) used?

A

The Common Gateway Interface is used when Apache hands off to external programs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How is the mod_lsapi module unique?

A

The mod_lsapi module hands off the work to lsphp processes. While these processes are spawned as needed by Apache, they are not Apache children.

Additionally, each user’s lsphp processes are kept in their own LVE/CageFS, so users cannot interfere with each other. If there are no requests for sites from that user in lsapi_backend_pgrp_max_idle seconds, the process will be terminated and need to be respawned when the next request comes in.

Note:
mod_lsapi is only available with CloudLinux.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

The Apache binary file.

A

/usr/sbin/httpd —

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

This directory contains all the logs for the apache2 file and all the access logs.

A

/var/log/apache2/ —

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

This directory contains the configuration directory for Apache and contains all directories for Apache includes, modules, and configuration files. This directory does not contain log files.

A

/etc/apache2/ —

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

The primary Apache configuration file.

A

/etc/apache2/conf/httpd.conf —

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

This directory contains an alias to the /var/log/apache2/ directory.

A

/etc/apache2/logs/ —

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

This directory contains all of the dynamic modules for Apache.

A

/usr/lib64/apache2/modules/ —

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

This file contains HTTP requests that the server received and that did not go to a domain.

A

/etc/apache2/logs/access_log/ —

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

The primary Apache configuration file directory.

A

/etc/apache2/conf.d/ —

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

The directory that contains the include files that add content to the httpd.conf file. You can modify these configuration files via the command line interface (CLI) or WHM’s Include Editor interface (WHM&raquo_space; Home&raquo_space; Service Configuration&raquo_space; Apache Configuration&raquo_space; Include Editor).

A

/etc/apache2/conf.d/includes/ —

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

This file contains error information.

A

/etc/apache2/logs/error_log/ —

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

This directory contains an alias to the /usr/lib64/apache2/modules/ directory.

A

/etc/apache2/modules/ —

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Break down this log

[Thu Sep 25 17:34:34.185015 2014] [mpm_prefork:notice] [pid 25070] AH00169: caught SIGTERM, shutting down

A

This entry contains two additional details - what module and pid generated the message:

timestamp = [Thu Sep 25 17:34:34.185015 2014]
module severity level = [mpm_prefork:notice]
process id: [pid 25070]
message: AH00169: caught SIGTERM, shutting down

note: The Apache error log contains all messages from Apache itself that are not logs of requests, so you may see many logs that are not actually errors at all. There are other logs, such as the suexec and suPHP logs, that have their own logs with their own formats.

21
Q

Describe the categories of error codes that apache sends to the web browser

A

1xx Informational codes. We never see these.
2xx Success codes. It’s working, no problem to process.
3xx Redirection. You’ll see these referenced in .htaccess files, but they are not a source of issues.
4xx Client Errors
404 File not found. Most commonly seen when there are tomcat issues, mod_userdir issues, or document root issues.
5xx Server Errors
500 Internal Server Error. Most commonly seen when there are permission or script issues. Check the error logs for more information. Sometimes seen with CloudLinux when a site reaches a memory or processor limit part way through processing a request.
503 Service Unavailable. Most commonly seen with CloudLinux when a site reaches one of its limits at an expected juncture.

22
Q

Describe the different sections of apache documentation: The parts of the Apache documentation you’re most likely to need are the Syntax, Defaults, and Context.

A

Syntax tells you what the directive should look like, Default tells you what happens when the directive is not explicitly set, and Context tells you where you can set it. Note that the full description (under the short box) does contain valuable information.

23
Q

What user do apache children run as?

A

Apache children run as nobody (or the user if using mod_ruid2)

24
Q

What user do apache children run as?

A

Apache children run as nobody (or the user if using mod_ruid2)

25
Q

What’s the command used to provision and install an easy apache profile on the command line?

(yes, you would normally do this through the whm interface)

A

/usr/local/bin/ea_current_to_profile

/usr/local/bin/ea_current_to_profile - -output=/etc/cpanel/ea4/profiles/custom/test.json

/usr/local/bin/ea_install_profile - -install /etc/cpanel/ea4/profiles/custom/test.json

26
Q

How would you manually create a profile?

A

Manually creating a profile is a little different. For that, you must navigate to /etc/cpanel/ea4/profiles/custom and then create a json file with the correct structure (see below).

{“version”:”1.2”,”name”:”SuperHost Profile”,”tags”:[“Apache 2.4”,”PHP 5.4”,”tomorrow comes
knocking”,”…”],”desc”:”This profile will allow you to have super high density on your
system”,”pkgs”:[“ea-mod_xyz”,”ea-php54”,”ea-php56”,”ea-your_frog”,”…”]}

27
Q

How would you manually create a profile?

A

Manually creating a profile is a little different. For that, you must navigate to /etc/cpanel/ea4/profiles/custom and then create a json file with the correct structure (see below).

{“version”:”1.2”,”name”:”SuperHost Profile”,”tags”:[“Apache 2.4”,”PHP 5.4”,”tomorrow comes
knocking”,”…”],”desc”:”This profile will allow you to have super high density on your
system”,”pkgs”:[“ea-mod_xyz”,”ea-php54”,”ea-php56”,”ea-your_frog”,”…”]}

28
Q

Where are the main templates for easy apache configuration files located?

A

/var/cpaenl/templates/apache2_{2,4}

From there, everything outside of virtual hosts can be found in ea4_main.default. Secure virtual hosts are in ssl_vhost.default and normal virtual hosts are vhost.default.

User configurations will be found in /var/cpanel/userdata/$USERNAME/{main, $DOMAIN}.

It is also important to note that SSL configurations are in a separate file:

# ls -1 /var/cpanel/userdata/cptest/{main,cptest.domain{,_SSL}}
/var/cpanel/userdata/cptest/cptest.domain
/var/cpanel/userdata/cptest/cptest.domain_SSL
/var/cpanel/userdata/cptest/main
29
Q

Global includes from /etc/apache2/conf.d/includes can be managed in WHM under

A

Home&raquo_space; Service Configuration&raquo_space; Apache Configuration&raquo_space; Include Editor.

30
Q

Domain configuration include files are found in

A

/etc/apache2/conf.d/userdata

31
Q

Domain configuration include files are found in

A

/etc/apache2/conf.d/userdata. Structure of the include files are as follows:

All virtual domains with SSL: userdata/ssl/2_4/.conf
All virtual domains without SSL: userdata/std/2_4/
.conf

Users’ virtual domains with SSL: userdata/ssl/2_4/$USER/*.conf

Users’ virtual domains without SSL: userdata/std/2_4/$USER/.conf
Virtual domain with SSL: userdata/ssl/2_4/$USER/$DOMAIN/
.conf
Virtual domain without SSL: userdata/std/2_4/$USER/$DOMAIN/*conf

These must end in .conf and be owned by root. They must also always have 600 permissions. Includes are appended to the end of the virtual host with an include configuration line.

32
Q

EA4 builds each VirtualHost tag from the following components:

A

Custom templates in the subdirectories in the /var/cpanel/templates/2_{2,4} directory

Account information for each domain – When you make a configuration change to an account or domain in the cPanel or WHM interfaces, cPanel & WHM changes the content of the appropriate file in the /var/cpanel/userdata/$USERNAME directory

Additional include files for each account, user or domain – EasyApache includes the files in the appropriate /etc/apache2/conf.c/userdata/ directory for each domain to build the configuration of each VirtualHost tag

33
Q

How many php installations are on a standard cpanel environment.

A

2

There are the primary PHP installations that are used for Apache to interact with and serve production PHP content, and then there’s the Internal PHP installation that cPanel specifically uses for its own internal operations that require PHP.

34
Q

The default path to the internal PHP binary is:

A

/usr/local/cpanel/3rdparty/bin/php.

35
Q

The cPanel default profile includes what PHP versions

A

7.1 and 7.2.

36
Q

EasyApache 4 supports PHP versions what

A

5.4, 5.5, 5.6, 7.0, 7.1, 7.2, and 7.3.

37
Q

How would you install a particular php version on your system?

A

Use the yum install command to install your desired PHP version. You can select from the following PHP packages:

ea-php54
ea-php55
ea-php56
ea-php70
ea-php71
ea-php72
Any custom PHP package name.
38
Q

To change a domain’s PHP version, perform the following steps:

A

Select the checkbox for the domain that you wish to change.
Select the desired version of PHP from the PHP Version menu. To always use the system default, select inherit.
Click Apply. The system will change the selected domain’s PHP version.

39
Q

What does a php “handler” do?

A

This is a module that tells Apache how to handle the PHP scripts because Apache does not natively support PHP scripts.

40
Q

What script is used to change php handlers?

A

/usr/local/cpanel/bin/rebuild_phpconf –help

41
Q

If your php handler script errors out, what log can you check?

A

/usr/local/cpanel/logs/error_log

42
Q

What happens if you misconfigure an apache custom template?

A

A messed up (invalid) httpd.conf will be generated and then apache will not be able to accept any requests.

“if they’re misconfigured (syntactically invalid) the apache conf will fail to rebuild with /scripts/rebuildhttpdconf”

43
Q

What is a “must” for virtualhost includes?

A

It is important to note that the file must end in .conf, be owned by root, and have 600 permissions!

44
Q

This interface allows you to enable/disable the Apache mod_userdir module’s functionality for end-users.

Warning

We strongly recommend that customers disable this access for most of their users. Before you use this interface, make certain that you read the Security Implications and Warnings sections below.

If someone has enabled Apache’s ruby24-mod_passenger module in WHM’s EasyApache 4 interface (WHM >> Home >> Software >> EasyApache 4), the system disables Apache’s module by default.

A person must enable this feature to allow accounts to use shared SSL certificates.
A

what about mod_userdir? look up more information in the wiki so that I can understand this and make flashcards out of it

45
Q

What does mod_userdir do?

A

The Apache mod_userdir module allows visitors to access a user’s website via a URL that contains that user’s username. For example, the following URLs point to the username directory:

https: //host.example.com/~username
https: //example.net/~username 
https: //192.168.0.20/~username
46
Q

How is mod_userdir used most of the time?

A

Most servers use the Apache mod_userdir module as a temporary URL system that allows users to view their websites. This temporary URL system functions even if the system does not possess a configured DNS or the domain does not yet point to the server.

When you enable the Apache mod_userdir module, any virtual host can access any website that uses the same IP address. It does not function only with the hostname.

47
Q

What’s the recommended way to customize an apache configuration

A

With includes!

48
Q

How do you change MPM from the command line for easyapache 4?

A

yum shell

reference the cheat sheet (it’s an image)