Created
June 28, 2016 18:54
-
-
Save ultimagriever/5eea2d516773239b0a4203de2473df65 to your computer and use it in GitHub Desktop.
Automatic Nginx Server Block Generation
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
# sh nginx.sh <app name> | |
APP=$1 | |
if [[ $APP == "" ]]; then | |
echo "Please provide app name." | |
exit; | |
fi | |
NGINX_PATH=/usr/local/etc/nginx | |
cp $NGINX_PATH/sites-enabled/template.dev $NGINX_PATH/sites-enabled/$APP.dev | |
sed -i '' "s/app/$APP/g" $NGINX_PATH/sites-enabled/$APP.dev | |
echo "Config created for $APP" | |
cat $NGINX_PATH/sites-enabled/$APP.dev | |
sudo brew services restart nginx |
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
server { | |
listen 80; | |
server_name app.dev; | |
root /Users/pamela/Sites/app/public; | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
index index.html index.htm index.php; | |
autoindex on; | |
} | |
location ~ \.php$ { | |
try_files $uri $uri/ /index.php?$query_string; | |
#fastcgi_pass unix:/tmp/php-fpm.sock; | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment