Ubuntu Server23.04 ; WEB Server(Apache)

Apache2 Install

Allow http:80 port and https:443 port in UFW first.

1 Apache2 Install

2 Apache2 Basic Settings

Apache Restart

3 Apache2 : Using Perl Scripts

Enable CGI to make Perl scripts available
①Perl Install

②Enable CGI module and restart

③Confirm CGI module is enabled
Create test scripts

Authorize the script file

operation check

4 Apache2 : Using PHP Scripts

①PHP Install

②Apache2 Configuration

Apache Restart

③Create a PHP test page and check its operation

If you access http://[server IP address]/index.php with a browser and the following screen appears, success!

5 Apache2 : 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 the configuration file you created
Document root is set to /var/www/html//.

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

④Edit hosts file

⑤Directory Create

⑥Create test pages and check operation

⑦If you access "http:///index.html" in your browser, the following screen should appear

6. Digest authentication with Apache2

Since Basic Authentication, a well-known authentication authentication method for http, transmits 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 the authentication information and sends it in encrypted form, 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" in the "DigestAuth" realm.
Execute the following command and enter the "secretuser" password.

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

Add the following at the end

Create a directory for Digest authentication

Enable Digest authentication and restart

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

Copied title and URL