Skip to content

Bash script for creating/deleting NGINX local hosts for mac

Notifications You must be signed in to change notification settings

windeko/makehost

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

makehost

Bash script for creating/deleting NGINX local hosts for Mac OSX

There is makehost bashscript. Easiest way to create and delete localhosts for NGINX. This version had been writing for MacOS X. You can fork and write version for your OS.

Installation

  1. Download the script
  2. Apply permission to execute:
$ chmod +x /path/to/makehost
  1. Copy the file to your /usr/local/bin directory:
$ sudo cp /path/to/makehost /usr/local/bin/makehost

Usage

$ sudo makehost [add | delete] [domain] [optional host_dir]

Examples

to create a new virtual host:

$ sudo makehost add mysite.loc

to create a new virtual host with custom directory name:

$ sudo makehost add mysite.loc my_dir

to delete a virtual host

$ sudo makehost delete mysite.loc

to delete a virtual host with custom directory name:

$ sudo makehost delete mysite.loc my_dir

My configs

/usr/local/etc/nginx/nginx.conf


worker_processes  1;

error_log  /usr/local/var/log/nginx/error.log;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$re$
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /usr/local/var/log/nginx/access.log  main;

    sendfile        on;

    keepalive_timeout  65;

    index index.html index.php;

    upstream www-upstream-pool{
        server unix:/tmp/php-fpm.sock;
    }

    include /etc/nginx/conf.d/*.conf;
    include /usr/local/etc/nginx/sites-enabled/*.conf;
}

/private/etc/hosts


127.0.0.1       localhost       *.loc
255.255.255.255 broadcasthost
::1             localhost

About

Bash script for creating/deleting NGINX local hosts for mac

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages