Contents
Apache2 installation and virtual host configuration
1.Apache2 installed
①Install httpd
# dnf -y install httpd
Version Check
# httpd -v
Server version: Apache/2.4.53 (Fedora Linux)
Server built: Mar 17 2022 00:00:00
2.Apache Configuration
# vi /etc/httpd/conf/httpd.conf
●Line 91 : Specify administrator address
ServerAdmin [Email Address] ●Per line 100: Change ServerName
Add "ServerName <domain name>" under "#ServerName www.example.com:80"
●Line 149 : Change (Indexes is deleted)
Options FollowSymLinks
●Line 156 : Change
AllowOverride All
●Line 169 : file name accessible only by directory name
Add "index.php index.cgi"
●Add to last line
ServerTokens Prod
# firewall-cmd --reload
# systemctl enable httpd
# systemctl status httpd
If the Fedora Webserver Test Page is displayed as follows when accessing http://[server IP address], it is OK.

# mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf.org
# vi /var/www/html/index.html
<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Apache Test Page
</div>
</body>
</html>

3.Virtual Host Settings
Assign and configure the domain name [fedora.korodes.com] to the document root [/var/www/html/fedora.korodes.com] directory for virtual host operation
# vi /etc/httpd/conf.d/vhost.conf
Virtual Host Domain Settings
<VirtualHost *:80>
DocumentRoot /var/www/html/fedora.korodes.com
ServerName fedora.korodes.com
ServerAdmin<Email Address>
ErrorLog logs/fedora.korodes.com-error_log
CustomLog logs/fedora.korodes.com-access_log combined
</VirtualHost>
<Directory "/var/www/html/fedora.korodes.com">
Options FollowSymLinks
AllowOverride All
</Directory>
Creating a Document Directory
Restart Apache
Confirmation of CGI Script Usage
①CGI availability check
252: ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
The above is displayed and available under "/var/www/cgi-bin/".
②Create test scripts and check operation
#!/usr/bin/python3
print("Content-type: text/html\n")
print("CGI Script Test Page")# chmod 755 /var/www/cgi-bin/index.cgi
# curl localhost/cgi-bin/index.cgi
CGI Script Test Page
PHP installation and configuration
1.PHP Installation
# systemctl status php-fpm
● php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor >
Active: active (running)since Sun 2022-05-15 09:48:09 JST; 7s ago
Main PID: 3386 (php-fpm)
Status: "Ready to handle connections"
Tasks: 6 (limit: 4614)
Memory: 9.8M
CPU: 28ms
CGroup: /system.slice/php-fpm.service
tq3386 "php-fpm: master process (/etc/php-fpm.conf)"
tq3387 "php-fpm: pool www" "" "" "" "" "" "" "" "" "" "" "" "" "" >
tq3388 "php-fpm: pool www" "" "" "" "" "" "" "" "" "" "" "" "" "" >
tq3389 "php-fpm: pool www" "" "" "" "" "" "" "" "" "" "" "" "" "" >
tq3390 "php-fpm: pool www" "" "" "" "" "" "" "" "" "" "" "" "" "" >
mq3391 "php-fpm: pool www" "" "" "" "" "" "" "" "" "" "" "" "" "" >May 15 09:48:09 fedora systemd[1]: Starting The PHP FastCGI Process Manager...
May 15 09:48:09 fedora systemd[1]: Started The PHP FastCGI Process Manager.er.
Create the following files
<?php phpinfo(); ?>
