・メインドメインの設定(www.papa-net.com)

[root@alma]# vi /etc/httpd/conf.d/www.papa-net.com.conf

≪ 以下新規作成 ≫

<VirtualHost *:80>
  
DocumentRoot /home/*****/www※ホームページデータ格納ディレクトリ
ServerName www.papa-net.com
ErrorLog logs/www.papa-net.com-error_log
CustomLog logs/www.papa-net.com-access_log combined env=!no_log

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

<Directory "/home/*****/www">※ホームページデータ格納ディレクトリ
Options ExecCGI FollowSymLinks
AllowOverride All
Require all granted
</Directory>

<IfModule alias_module>
ScriptAlias /cgi-bin/ "/home/*****/www/cgi-bin/"※ホームページデータ格納ディレクトリ
</IfModule>

<Directory "/home/*****/www/cgi-bin">※ホームページデータ格納ディレクトリ
AllowOverride None
Options Includes ExecCGI FollowSymLinks
Require all granted
</Directory>

</VirtualHost>

・サブドメインの設定(sub.papa-net.com)

[root@alma]# vi /etc/httpd/conf.d/sub.papa-net.com.conf

≪ 以下新規作成 ≫

<VirtualHost *:80>
  
DocumentRoot /home/*****/sub※ホームページデータ格納ディレクトリ
ServerName sub.papa-net.com
ErrorLog logs/sub.papa-net.com-error_log
CustomLog logs/sub.papa-net.com-access_log combined env=!no_log

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

<Directory "/home/*****/sub">※ホームページデータ格納ディレクトリ
Options ExecCGI FollowSymLinks
AllowOverride All
Require all granted
</Directory>

<IfModule alias_module>
ScriptAlias /cgi-bin/ "/home/*****/sub/cgi-bin/"※ホームページデータ格納ディレクトリ
</IfModule>

<Directory "/home/*****/sub/cgi-bin">※ホームページデータ格納ディレクトリ
AllowOverride None
Options Includes ExecCGI FollowSymLinks
Require all granted
</Directory>

</VirtualHost>

・別ドメインの設定(www.mama-net.jp)

[root@alma]# vi /etc/httpd/conf.d/www.mama-net.jp.conf

≪ 以下新規作成 ≫

<VirtualHost *:80>
  
DocumentRoot /home/*****/mama※ホームページデータ格納ディレクトリ
ServerName mama-net.jp
ErrorLog logs/mama-net.jp-error_log
CustomLog logs/mama-net.jp-access_log combined env=!no_log

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

<Directory "/home/*****/mama">※ホームページデータ格納ディレクトリ
Options ExecCGI FollowSymLinks
AllowOverride All
Require all granted
</Directory>

<IfModule alias_module>
ScriptAlias /cgi-bin/ "/home/*****/mama/cgi-bin/"※ホームページデータ格納ディレクトリ
</IfModule>

<Directory "/home/*****/mama/cgi-bin">※ホームページデータ格納ディレクトリ
AllowOverride None
Options Includes ExecCGI FollowSymLinks
Require all granted
</Directory>

</VirtualHost>