MiracleLinux9.2 ; WEB Server(Apache2) Install 

1.Apache2 Install / Virtual Hosts

1.1 Apache2

httpd install

1.2 Apache Configuration

Edit httpd.conf file

If Firewalld is enabled, HTTP service permission is required; HTTP uses [80/TCP]

Apache Auto-Start Configuration

operation check
If you access http://[server IP address] and MiracleLinux Test Page is displayed as follows, it is OK.

⑤Hide the Welcome page, create a new index.html file as a Test Page, and check the operation of apache.

Rename the welcome page

If you access "http://<server IP address> "and the Test Page is displayed as shown below, it is OK.

1.3 Virtual Host Settings

Assign and configure the domain name [miracle.korodes.com] to the document root [/var/www/html/miracle.korodes.com] directory for virtual host operation

Creating a Document Directory

Restart Apache

Create test pages and check operation

If the following screen appears when you access "http://miracle.korodes.com/index.html", it is normal.

2. Confirmation of CGI script use

①Confirmation of CGI availability

②Create test scripts and check operation

3. PHP installation and configuration

3.1.PHP Install

①Install

Version Check

If you are upgrading to PHP 8.2, you will need the Remi repository, so install it if you have not already done so.

Stop PHP once.

PHP 8.2 Install

php-fpm configuration

If the version is updated to 8.2, OK.

Restart Apache
After PHP installation, restarting Apache will invoke PHP-FPM (FPM : FastCGI Process Manager) by default, and php-fpm service will be started in conjunction with httpd startup.

Confirmation of PHP operation
Create the following file

If you access http://<domain name>/test.php in your browser and see the following screen, it is OK

4. Digest authentication with Apache2

Since Basic Authentication, a well-known authentication authorization method for http, sends authentication information in plain text, there is a risk of ID and password leakage if the packet is intercepted.
On the other hand, Digest Authentication encrypts and transmits authentication information, so there is almost no risk of information leakage.

4.1 Create password file for Digest authentication

Specify an authenticated area called realm. This realm allows the same directory to be accessed as authenticated.
For this example, the realm is "DigestAuth" and a user and password file named "secretuser" ".digestauth" is created.

Confirmation

As above, secretuser and encrypted password are created

4.2 Edit Apache configuration file

Specify the directory to which Digest authentication will be applied. (In this case, specify the "secret" directory.)

Add the following at the end

Create a directory for Digest authentication

Enable Digest authentication and reboot

When accessing http://[FQDN]/secret with a browser, a screen appears asking for "user name" and "password"

Copied title and URL