Giter Club home page Giter Club logo

vhost-manager-osx's Introduction

What is it?

A little script to quickly add virtual hosts to your local Apache configuration for development purposes on Mac OS X.

Given a name like "example.local" and a path to the files for the site root directory, it will make the site appear at http://example.local.

Currently it has been tested on Apache 2.4.23 in Mac OS Sierra.
It is also reported to work on Apache 2.4.28 in Mac OS El Capitan.

Installation

Make a directory to contain all the generated vhost config files:

sudo mkdir /etc/apache2/extra/vhosts

Add this line to your /etc/apache2/httpd.conf file:

Include /private/etc/apache2/extra/vhosts/*.conf

Do not restart Apache on this step.

Place the vhostman.rb to somewhere, for instance, somewhere in your home dir and add alias for this into your .bash_profile, like:

alias vhostman="sudo $HOME/somewhere/vhostman.rb"

Ensure it's executable:

chmod 777 $HOME/somewhere/vhostman.rb

That's it, now you can start to use it.

Usage

Create folder for your domain in your Sites dir ($HOME/Sites), for instance: example (for real, it doesn't matter how you'll name it)

mkdir $HOME/Sites/example

Next open Terminal and do like this to add example.local (it's what you will type in your browser):

vhostman add example.local $HOME/Sites/example

Apache will be restarted and virtual host config will be applied to get it work.

That’s it! You can view your site in browser: http://example.local.

Fixing issues

bad interpreter: Operation not permitted

If you get an error like this:

bad interpreter: Operation not permitted

Then do this:

xattr -d com.apple.quarantine vhostman.rb

ERROR: Specified webroot dir does not exist

It's possible the webroot path contains a space. In this case enclose the path in quotes, and do not escape spaces with a backslash:

vhostman add example.local "$HOME/path with spaces/Sites/example"

vhost-manager-osx's People

Contributors

jamiemill avatar swankylynx avatar christianvermeulen avatar meredevelopment avatar sultanshakir avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.