Debian12.5 ; WEB Server(Apache)

Web server Apache2 installation

Allow http:80 and https:443 ports in UFW before installation

1 Apache2 Installation and Configuration

Apache2 Install

2.Basic Apache2 Configuration

Restart Apache

3.  Apache2; Using Perl Scripts

Enable CGI to make Perl scripts available
①Install Perl

②Enable CGI module and restart

③Check the validity of CGI modules
Create test scripts

Authorize script files

operation check

4 Apache2 : Using PHP Scripts

Install PHP

Apache2 Configuration

Create a PHP test page and check its operation

Access http://<server IP address>/index.php with a browser and if the following screen appears, OK

5. Virtual Host Settings

Copy the default configuration file (file name is arbitrary, in this case vhost-yourdomain.conf as an example) and configure the virtual host

Edit configuration file

Symbolic link to the configuration file to disable the default configuration file

Edit hosts file

directory creation

Create test pages and check operation

Access "http://<FQDN>/index.html" with a browser to check

6. 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.

6.1 Create password file for Digest authentication

Specify an authenticated area called realm. This realm allows the same directory to be accessed as authenticated.
As an example, we will create a user named "secretuser" with "DigestAuth" as the realm. Execute the following command and enter the password for "secretuser" when prompted.

Confirmation

As above, secretuser and encrypted password are created

6.2 Edit Apache configuration file

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

Create a directory for Digest authentication

Enable Digest authentication and reboot

When accessing http://<FQDN>/ with a browser, a screen appears asking for "user name" and "password".

Copied title and URL