ยง2023-04-14
Not Working!!!
- apt install
$ sudo apt install apache2
- start
$ systemctl start apache2
- Configure
- list to other port, /etc/apache2/ports.conf
# diff ports.conf.ori ports.conf
5c5
< Listen 80
---
> Listen 8888
mount -t cifs -o rw,vers=3.0,credentials=/home/alexlai/.smb //munetaka.me/JupyterHub /opt/munetakaJupyterHub/
- ?? enable /opt/munetakaJupyterHub directory listing ??
/var/www/html# mv index.html index.html.ori
/var/www/html# ln -sf /opt/munetakaJupyterHub/ muentakaJupyetrHub
- Suggested by ChatGPT
To configure Apache2 to serve Markdown files as HTML, you can use the mod_md module along with the mod_rewrite module. Here's how you can do it:
- Install the libmarkdown2-dev package:
sudo apt update && apt install libmarkdown2-dev
- Enable the mod_md and mod_rewrite modules:
sudo a2enmod md
sudo a2enmod rewrite
-
Create a new virtual host configuration file:
sudo nano /etc/apache2/sites-available/markdown.conf
Add the following configuration to the file:
<VirtualHost *:8888>
ServerName example.com
DocumentRoot /var/www/html
<Directory /var/www/html>
Options +FollowSymLinks
AllowOverride All
</Directory>
AddType text/html .md
AddHandler markdown-script .md
Action markdown-script /cgi-bin/markdown
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.md -f
RewriteRule ^(.*)$ $1.md [L]
<Directory /var/www/html/cgi-bin>
Require all granted
Options +ExecCGI
SetHandler cgi-script
</Directory>
</VirtualHost>
Replace example.com with your domain name and /var/www/html with the path to your website's root directory.
- Create a new directory for CGI scripts:
sudo mkdir /var/www/html/cgi-bin
- Create a new CGI script that will render Markdown files as HTML:
sudo apt-get install python3-markdown
sudo nano /var/www/html/cgi-bin/markdown
sudo chmod +x /var/www/html/cgi-bin/markdown
as
#!/bin/bash
/usr/bin/markdown_py "$@"
- Enable the new virtual host configuration:
sudo a2ensite markdown.conf
- Enable the mod_actions module:
sudo a2enmod actions
- Restart Apache2:
sudo systemctl restart apache2
Now, any Markdown files that you place in the website's root directory with the .md or .markdown extension will be served as HTML. For example, if you have a file named example.md, it will be served as example.html when accessed through a web browser.