You could use mod_macro, which has been included in Apache httpd since version 2.4
Before that it had to be installed separately, see mod_macro. For example on Debian: apt-get install libapache2-mod-macro; a2enmod macro
.
Example configuration
/etc/apache2/conf.d/vhost.macro
<Macro VHost $host $port>
<VirtualHost $host:$port>
ServerName $host
DocumentRoot /var/vhosts/$host
<Directory /var/vhosts/$host>
# do something here...
</Directory>
</VirtualHost>
</Macro>
/etc/apache2/sites-available/vhost.mysite.com
Use VHost vhost.mysite.com 80
Related Posts:
- How do I select which Apache MPM to use?
- Redirect, Change URLs or Redirect HTTP to HTTPS in Apache – Everything You Ever Wanted to Know About mod_rewrite Rules but Were Afraid to Ask
- Finding out what user Apache is running as?
- Is it bad to redirect http to https?
- Is it possible to generate RSA key without pass phrase?
- What does Apache’s “Require all granted” really do?
- Multiple SSL domains on the same IP address and same port?
- How do I prevent apache from serving the .git directory?
- Proxy Error 502 “Reason: Error reading from remote server” with Apache 2.2.3 (Debian) mod_proxy and Jetty 6.1.18
- How does ServerName and ServerAlias work?
- Dealing with HTTP w00tw00t attacks
- Apache2 config variable is not defined
- How to get Apache2 to redirect to a subdirectory
- Why is the response on localhost so slow?
- Do you have any useful awk and grep scripts for parsing apache logs? [closed]
- apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
- api-ms-win-crt-runtime-l1-1-0.dll is missing when opening Microsoft Office file [closed]
- Istio Ingress resulting in “no healthy upstream”
- What is a LAMP stack?
- What is the difference between POST and PUT in HTTP?
- What and where are the stack and heap?
- What is a reverse shell?
- Why am I getting error for apple-touch-icon-precomposed.png
- How could I ping @here in Discord.py?
- What’s the syntax for mod in java
- STDERR? What is it? What are its common uses?
- Handling file renames in Git
- PermissionError: [Errno 13] in Python
- Why are there two ways to unstage a file in Git?
- ssh remote host identification has changed
- How to link to part of the same document in Markdown?
- What is {{.}} in mustache?
- How to split column into two in R using separate
- Python Key Error=0 – Can’t find Dict error in code
- In C++, what is wx.h?
- How to UPSERT (MERGE, INSERT … ON DUPLICATE UPDATE) in PostgreSQL?
- What is the difference between allFile and allMarkdownRemark in gatsby
- DynamoDB : The provided key element does not match the schema
- How do I run a single test using Jest?
- Why I am getting java.lang.AbstractMethodError errors?
- Mercurial: no ~/.hgrc file
- PHP &$string – What does this mean?
- difference between ‘-webkit-box-shadow’ & ‘box-shadow’ in css
- Operand type clash: int is incompatible with date + The INSERT statement conflicted with the FOREIGN KEY constraint
- Update Git branches from master
- declaring a priority_queue in c++ with a custom comparator
- How to interactively (visually) resolve conflicts in SourceTree / git
- How to get the selected item from a ComboBox in JavaFX?
- Downcasting in Java
- How do I get monitor resolution in Python?
- Is there an online application that automatically draws tree structures for phrases/sentences?
- Create new tmux session from inside a tmux session
- classic ASP error ‘80020009’ Exception occurred
- Disable Chrome pinch zoom for use in kiosk
- How to ‘minify’ Javascript code
- How to extract Month from date in R
- Receiving “message”:”CB-ACCESS-KEY header is required” when attempting to connect to coinbase pro api
- Missing files, DirectX SDK (d3dx9.lib, d3dx9.h)
- how to center form using bootstrap 4
- RGBA code for red color
- java array error “array required but int found”
- this: Cannot use this in static context
- Fail to create Android virtual Device, “No system image installed for this Target”
- How do I select text nodes with jQuery?
- Missing sudo password in Ansible
- Warning: session_start(): Cannot send session cookie – headers already sent by (output started at [duplicate]
- In Java, what is a shallow copy?
- conversion to inaccessible base class is not allowed [duplicate]
- A difference between statement and decision coverage
- How to draw a line with matplotlib?
- ifference between ibatis and mybatis
- How to install PyQt4 on Windows using pip?
- Example of realpath function in C
- Printing a 2D array in C
- Send an email that contains a HTML and plain text part
- Contact Form 7: Redirecting on a condition? [closed]
- Deleting images in array
- Next Previous siblings child pages
- dbDelta with the character ;
- Limiting the posts on the homepage to one taxonomy? [closed]
- add_image_size sizes not stored
- robocopy transfer file and not folder
- What’s the difference between include_tasks and import_tasks?
- rm on a directory with millions of files
- What ports to open for mail server?
- Why is Enterprise Storage so expensive?
- Should a wildcard SSL certificate secure both the root domain as well as the sub-domains?
- What limits the maximum number of connections on a Linux server?
- Why can’t MX records point to an IP address?
- How to show all banned IP with fail2ban?
- How can I get diff to show only added and deleted lines? If diff can’t do it, what tool can?
- Adding a user to an additional group using ansible
- Best system administrator accident [closed]
- Reread partition table without rebooting?
- Storing a million images in the filesystem
- How to keep rsync from chown’ing transferred files?
- How to view connected users to open vpn server?
- What does that mean: packages excluded due to repository priority protections
- How can I set a short timeout with the ping command?