業務用エアコン関連の技術情報、エラーコード、環境問題対策に関する別サイト「エアコンの安全な修理・適切なフロン回収」

Ubuntu Server26.04 : WEB Server(Apache)

Apache2

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

1. Apache2 Install

2. Apache2 Basic Settings

Apache Restart

Apache Startup Verification

3. Apache2 Operation Verification

http://[server IP address] If you access this URL and see the Ubuntu Apache2 Default Page as shown below, it's OK.

Hide the default page, create a new index.html file as a Test Page, and verify Apache operation
Rename the default page

Create an HTML test page

http://[server IP address] If the Test Page appears as shown below when you access it, you're good to go.

4. Apache2 : Virtual Host Configuration

Copy the default configuration file (name it whatever you like; for this example, use vhost.conf) and configure the virtual host.

②Edit the created configuration file
The document root is set to /var/www/html/[FQDN]/

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://[FQDN]/index.html" in your browser, the following screen should appear

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

6. Apache2 : Using PHP Scripts

PHP Install

Apache2 Configuration

[php.ini] Edited Content

Line 693 : Change
#post_max_size = 8M
post_max_size = 300M

Line 851 : Change
#upload_max_filesize = 2M
upload_max_filesize = 200M

Line 964:Uncomments and set time zone
date.timezone = "Asia/Tokyo"

Apache Restart

Create a PHP test page and check its operation

If you access http://[FQDN]/test.php with a browser and the following screen appears, success!

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

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

7.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://[FQDN]/secret with a browser, a screen appears asking for "user name" and "password".

Copied title and URL