Created
March 18, 2015 16:05
-
-
Save edheltzel/4fd5eb1e664a18db8c26 to your computer and use it in GitHub Desktop.
setting up a vhost
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(export USERHOME=$(dscl . -read /Users/`whoami` NFSHomeDirectory | awk -F"\: " '{print $2}') ; cat > ~/Sites/httpd-vhosts.conf <<EOF | |
# | |
# Listening ports. | |
# | |
#Listen 8080 # defined in main httpd.conf | |
Listen 8443 | |
# | |
# Use name-based virtual hosting. | |
# | |
NameVirtualHost *:8080 | |
NameVirtualHost *:8443 | |
# | |
# Set up permissions for VirtualHosts in ~/Sites | |
# | |
<Directory "${USERHOME}/Sites"> | |
Options Indexes FollowSymLinks MultiViews | |
AllowOverride All | |
<IfModule mod_authz_core.c> | |
Require all granted | |
</IfModule> | |
<IfModule !mod_authz_core.c> | |
Order allow,deny | |
Allow from all | |
</IfModule> | |
</Directory> | |
# For http://localhost in the users' Sites folder | |
<VirtualHost _default_:8080> | |
ServerName localhost | |
DocumentRoot "${USERHOME}/Sites" | |
</VirtualHost> | |
<VirtualHost _default_:8443> | |
ServerName localhost | |
Include "${USERHOME}/Sites/ssl/ssl-shared-cert.inc" | |
DocumentRoot "${USERHOME}/Sites" | |
</VirtualHost> | |
# | |
# VirtualHosts | |
# | |
## Manual VirtualHost template for HTTP and HTTPS | |
#<VirtualHost *:8080> | |
# ServerName project.dev | |
# CustomLog "${USERHOME}/Sites/logs/project.dev-access_log" combined | |
# ErrorLog "${USERHOME}/Sites/logs/project.dev-error_log" | |
# DocumentRoot "${USERHOME}/Sites/project.dev" | |
#</VirtualHost> | |
#<VirtualHost *:8443> | |
# ServerName project.dev | |
# Include "${USERHOME}/Sites/ssl/ssl-shared-cert.inc" | |
# CustomLog "${USERHOME}/Sites/logs/project.dev-access_log" combined | |
# ErrorLog "${USERHOME}/Sites/logs/project.dev-error_log" | |
# DocumentRoot "${USERHOME}/Sites/project.dev" | |
#</VirtualHost> | |
# | |
# Automatic VirtualHosts | |
# | |
# A directory at ${USERHOME}/Sites/webroot can be accessed at http://webroot.dev | |
# In Drupal, uncomment the line with: RewriteBase / | |
# | |
# This log format will display the per-virtual-host as the first field followed by a typical log line | |
LogFormat "%V %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combinedmassvhost | |
# Auto-VirtualHosts with .dev | |
<VirtualHost *:8080> | |
ServerName dev | |
ServerAlias *.dev | |
CustomLog "${USERHOME}/Sites/logs/dev-access_log" combinedmassvhost | |
ErrorLog "${USERHOME}/Sites/logs/dev-error_log" | |
VirtualDocumentRoot ${USERHOME}/Sites/%-2+ | |
</VirtualHost> | |
<VirtualHost *:8443> | |
ServerName dev | |
ServerAlias *.dev | |
Include "${USERHOME}/Sites/ssl/ssl-shared-cert.inc" | |
CustomLog "${USERHOME}/Sites/logs/dev-access_log" combinedmassvhost | |
ErrorLog "${USERHOME}/Sites/logs/dev-error_log" | |
VirtualDocumentRoot ${USERHOME}/Sites/%-2+ | |
</VirtualHost> | |
EOF | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment