https://github.com/codecat/apache-vhosts
Easy macros for making VirtualHosts in Apache configs.
https://github.com/codecat/apache-vhosts
Last synced: 4 months ago
JSON representation
Easy macros for making VirtualHosts in Apache configs.
- Host: GitHub
- URL: https://github.com/codecat/apache-vhosts
- Owner: codecat
- Created: 2015-09-04T15:21:13.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2020-02-24T20:23:42.000Z (almost 6 years ago)
- Last Synced: 2025-09-02T17:42:11.575Z (5 months ago)
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# VirtualHost macros
Easy macros for making VirtualHosts in Apache configs.
* The really short macros are really only useful for basic PHP
websites. For other purposes, you should still make
tags (and use the individual macros).
* For SSL, certificates should be located in /etc/apache2/certs/
* SSL bundle certificate is currently always loaded from
/etc/apache2/certs/root.crt
* Currently, admin is always admin@localhost, this should be
changed to a variable.
* Defualt port 80 redirects to https://localtest.me/ at the moment
## Examples
# Set up example.com as a vhost with /var/www_example.com/ as
# document root.
Use VHost example.com
# Set up example.com as a vhost with an SSL certificate at
# /etc/apache2/certs/example.com.crt and /example.com.key
Use SecureVHost example.com example.com
# Set up example.com to be accessible via SSL only (redirect)
Use SecureVHost example.com example.com
Use SecureVHostOnly example.com
## LetsEncrypt
To use LetsEncrypt with this config, first set up a config like this:
Use VHost example.com
Restart Apache and create `/var/www_example.com`. Then, run `letsencrypt-auto` with `webroot`, like this:
letsencrypt-auto certonly -a webroot --webroot-path /var/www_example.com/ -d example.com -d www.example.com --server https://acme-v01.api.letsencrypt.org/directory
You can now remove the first `VHost` macro use, and do something like this instead:
Use LetsEncryptVHost example.com
Use SecureVHostOnly example.com