§2023-04-14
Not Working!!!
$ sudo apt install apache2
$ systemctl start apache2
# 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/
/var/www/html# mv index.html index.html.ori
/var/www/html# ln -sf /opt/munetakaJupyterHub/ muentakaJupyetrHub
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:
sudo apt update && apt install libmarkdown2-dev
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.
sudo mkdir /var/www/html/cgi-bin
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 "$@"
sudo a2ensite markdown.conf
sudo a2enmod actions
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.
Return to Top