Skip to content

Instantly share code, notes, and snippets.

@mingodad
Created March 24, 2015 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mingodad/54b78e22f9766f39cacc to your computer and use it in GitHub Desktop.
Save mingodad/54b78e22f9766f39cacc to your computer and use it in GitHub Desktop.
Nginx script for local development
#After find the bases of this script here http://bneijt.nl/blog/post/running-nginx-for-local-development/
#I did some changes to make it more generic:
#--mynginx
#!/bin/bash
set -x
RELD="`dirname "$0"`"
ABSD=$PWD
NGINX_HOME=$HOME/local/nginx-last
if [ ! -e "$ABSD"/nginx.conf ]; then
sed "s,ROOT,$ABSD,;s,NGINX_HOME,$NGINX_HOME," < $RELD/mynginx.conf.local.template > $ABSD/nginx.conf
fi
exec $NGINX_HOME/sbin/nginx -c "$ABSD"/nginx.conf $*
#--mynginx.conf.local.template
worker_processes 1;
events {
worker_connections 1024;
}
pid ROOT/nginx_user.pid;
http {
access_log ROOT/nginx_access.log;
error_log ROOT/nginx_error.log info;
include NGINX_HOME/conf/mime.types;
default_type application/octet-stream;
sendfile on;
server {
listen 8080;
server_name localhost;
charset utf-8;
location / {
root ROOT;
autoindex on;
index index.html index.htm;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment