Rocky Linux8.6 : WEB Server

1. Install Apache2  & Virtual Host

1.1 Install Apache2

①Install httpd

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 you see Rocky HTTP server Test Page as shown below, it is OK.
⑤Hide Rocky test page, create a new index.html file as Test Page, and check apache operation

Rename the Rocky test page

Create HTML test 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 [rocky.korodes.com] to the document root [/var/www/html/rocky.korodes.com] directory for virtual host operation

Creating a Document Directory
Restart Apache

2. Use of CGI Scripts

①Confirmation of CGI availability

②Create test scripts and check operation

3. PHP installation and configuration

1.Install PHP

①install

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

③PHP operation check
Create the following files

Access http://<domain name>/test.php in your browser and if you 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.
As an example, we will create a user named "secretuser" and a password file ".digestauth" 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

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

Enable Digest authentication and reboot

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

タイトルとURLをコピーしました