Click here for "Safe Air Conditioner Repair and Proper Freon Recovery".(Japanese Version)

CentOS7.9 ; WEB Server Apache

1.Apache2 installation and virtual host setup

1.1 Apache2 Install

①Install httpd

1.2 Apache Configuration

①Edit httpd.conf file
②If Firewalld is enabled, HTTP service permission is required; use [80/TCP] for HTTP and [443/TCP] for HTTPS
③Apache Auto-Start Configuration

④operation check
If you access http://[server IP address] and the Test Page is displayed as shown below, 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 [cent.korodes.com] to the document root [/var/www/html/cent.korodes.com] directory for virtual host operation
Create a new /etc/httpd/conf.d/vhost.conf

Description

<VirtualHost *:80>
DocumentRoot /var/www/html/cent.korodes.com
ServerName cent.korodes.com
ServerAdmin<Email Address>  ←Administrator Email Address
ErrorLog logs/cent.korodes.com-error_log
CustomLog logs/cent.korodes.com-access_log combined
</VirtualHost>
<Directory "/var/www/html/cent.korodes.com">
Options FollowSymLinks
AllowOverride All
</Directory>

Creating a Document Directory

Restart Apache

2. Confirmation of CGI Script Usage

①CGI availability check

②Create test scripts and check operation

3. PHP installation and configuration

1.PHP Installation

①Install PHP7.4 (Remi repository)

②Version Check

③Restart Apache

④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 in 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.

4.1 Create password file for Digest authentication

Specify an authenticated area called realm. This realm is used to allow access to the same directory as authenticated.
In this example, the realm is "DigestAuth" and a user and password file named "secretuser" (".digestauth") is created. 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

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".
画像に alt 属性が指定されていません。ファイル名: 66216a549073fbbc5c6ff8d87bb8e569.jpg

Copied title and URL