<VirtualHost *:80>
ServerName localhost
ServerAdmin webmaster@localhost
DocumentRoot /home/kokaki/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
・Apache2設定ファイルバックアップ
<Directory /home/kokaki/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
・ファイル所有者変更・パーミッション付与
<!doctype html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>Hello!, Ubuntu On WSL</title>
</head>
<body>
<h1>Hello, Ubuntu!</h1>
</body>
</html>
・再起動
<VirtualHost _default_:443>
ServerName localhost
ServerAdmin kokaki@localhost
DocumentRoot /home/kokaki/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory
</VirtualHost>
kokaki@skynew:~$ sudo a2ensite default-ssl
Enabling site default-ssl.
To activate the new configuration, you need to run:
systemctl reload apache2
kokaki@skynew:~$ sudo a2enmod ssl
Considering dependency mime for ssl:
Module mime already enabled
Considering dependency socache_shmcb for ssl:
Enabling module socache_shmcb.
Enabling module ssl.
See /usr/share/doc/apache2/README.Debian.gz on how to configure SSL and create self-signed certificates.
To activate the new configuration, you need to run:
systemctl restart apache2
・再起動
<style>
#child1 {
background-color: lightblue;
}
#child2 {
background-color: lightgreen;
}
@media (min-width: 600px) {
#parent {
display: flex;
}
#child1 {
flex-grow: 1;
}
#child2 {
flex-grow: 1;
}
}
</style>
<div id="parent">
<div id="child1">子要素1</div>
<div id="child2">子要素2</div>
</div>
■TOPに戻るボタン作成
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"
rel="stylesheet"
integrity="sha512-..." crossorigin="anonymous" />
/* ボタン全体 */
#page_top {
width: 50px;
height: 50px;
position: fixed;
right: 10px;
bottom: 10px;
background: #e25407;
border-radius: 50%;
opacity: 0.6;
}
/* Font Awesome */
#page_top::before {
font-family: 'Font Awesome 5 Free';
font-weight: 900;
content: '\f102';
font-size: 20px;
color: #ffffff;
position: absolute;
top: 50%;
left: 50%;
translate: -50% -50%;
}
<a href="#" id="page_top" class="page_top_btn"></a>
<a id="header" href="/">Home</a>
■Apache2が起動しない(80番ポート使用中)
× apache2.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Wed 2025-01-15 10:36:48 JST; 1min 22s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 1126 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
Jan 15 10:36:48 skynew systemd[1]: Starting apache2.service - The Apache HTTP Server...
Jan 15 10:36:48 skynew apachectl[1128]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Jan 15 10:36:48 skynew apachectl[1128]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Jan 15 10:36:48 skynew apachectl[1128]: no listening sockets available, shutting down
Jan 15 10:36:48 skynew apachectl[1128]: AH00015: Unable to open logs
Jan 15 10:36:48 skynew systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
Jan 15 10:36:48 skynew systemd[1]: apache2.service: Failed with result 'exit-code'.
Jan 15 10:36:48 skynew systemd[1]: Failed to start apache2.service - The Apache HTTP Server.
kokaki@skynew:~$ sudo systemctl restart apache2
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xeu apache2.service" for details.
■Ubuntuで使用中の80番ポートを探す
java 250 tomcat 44u IPv6 1604 0t0 TCP *:http-alt (LISTEN)
・プロセス終了させてみる
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
新機能と改善のために最新の PowerShell をインストールしてください!https://aka.ms/PSWindows
PS C:\Users\pc> netstat -nao | Out-String -Stream | Select-String :80
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4892
TCP 192.168.0.105:51919 119.25.113.170:80 ESTABLISHED 4552
TCP 192.168.0.105:51951 119.25.113.170:80 ESTABLISHED 4552
TCP 192.168.0.105:51990 119.25.113.170:80 ESTABLISHED 4552
TCP 192.168.0.105:51991 119.25.113.170:80 ESTABLISHED 4552
TCP 192.168.0.105:51992 119.25.113.170:80 ESTABLISHED 4552
TCP 192.168.0.105:51993 119.25.113.170:80 ESTABLISHED 4552
TCP 192.168.0.105:51994 119.25.113.170:80 ESTABLISHED 4552
TCP 192.168.0.105:51995 119.25.113.170:80 ESTABLISHED 4552
TCP 192.168.0.105:51996 119.25.113.170:80 ESTABLISHED 4552
TCP 192.168.0.105:51997 119.25.113.170:80 ESTABLISHED 4552
TCP 192.168.0.105:51998 119.25.113.170:80 ESTABLISHED 4552
TCP 192.168.0.105:53471 23.46.155.69:80 TIME_WAIT 0
・netstat -nao | findstr -i :80 でもよい
PS C:\Users\pc>
タスクマネージャー > 詳細 で、上記「0.0.0.0:80」のPID「4892」をタスク終了させる。2025 kokaki.jp, Office.