-
-
Save MaartenGDev/13c26310d727941ea0cbea2b15572540 to your computer and use it in GitHub Desktop.
Create a local .dev domain.
This file contains 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
domain=$1 | |
# Current Nginx domain file | |
file="/etc/nginx/sites-available/$domain" | |
# Copy default site | |
cp /etc/nginx/sites-available/template $file | |
# Replace localhost to current domain | |
sed -i -e "s/localhost/$domain/g" $file | |
# Enable site by creating a symbolic link | |
ln -s $file /etc/nginx/sites-enabled/ | |
# Make the directory | |
mkdir /var/www/$domain | |
# Change owner to current user | |
chown -R $USER:$USER /var/www/$domain | |
# Default landing page for a domain | |
page="/var/www/$domain/index.html" | |
# Create a sample file | |
cp template.stub $page | |
sed -i -e "s/DOMAIN/$domain/g" $page | |
# Reload Nginx | |
service nginx reload |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment