4 Apache
David Campbell edited this page 2024-11-23 00:31:43 -05:00

Apache

Sitemap

To setup sscli a sitemap generator:

# As of this writing:
# installs nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash

# download and install Node.js (you may need to restart the terminal)
nvm install 22

# verifies the right Node.js version is in the environment
node -v # should print `v22.11.0`

# verifies the right npm version is in the environment
npm -v # should print `10.9.0`

# install sscli
npm i -g static-sitemap-cli

robots.txt

You can create an empty robots.txt file to allow crawling everything or you can restrict access.

Everytime you update your site

mdbook build --dest-dir /var/www/html/
sscli -b https://<your.domain.name> -r /var/www/html/

touch /var/www/html/robot.txt
# OR
cat > /var/www/html.robots.txt <<EOF 
User-agent: *
Allow: /
EOF

404 Pages (Global Setup)

Add a 404.md file to the root directory of your book. Deploy your site: mdbook build --dest-dir /var/www/html/

Edit /etc/apache2/apache.conf.

Add the line: ErrorDocument 404 /404.html

Restart Apache: systemctl restart apache2