Created
March 24, 2015 17:03
-
-
Save mingodad/54b78e22f9766f39cacc to your computer and use it in GitHub Desktop.
Nginx script for local development
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
#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