From 5f9583bfaeb5e3c58b54e94eefbbd44985a53fc8 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Wed, 29 Dec 2010 21:17:41 -0500 Subject: [PATCH] jeebus ... futzing around with nginx again so that absolute path in conf is not necessary --- docroot/Makefile | 22 ++++++++++++++++++++++ docroot/nginx-serve | 3 --- docroot/{nginx.conf => nginx.conf.in} | 13 ++++++------- docroot/php-serve | 2 -- 4 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 docroot/Makefile delete mode 100755 docroot/nginx-serve rename docroot/{nginx.conf => nginx.conf.in} (75%) delete mode 100755 docroot/php-serve diff --git a/docroot/Makefile b/docroot/Makefile new file mode 100644 index 0000000..64bf3a2 --- /dev/null +++ b/docroot/Makefile @@ -0,0 +1,22 @@ + +ROOT ?= $(PWD) +HTTP_PORT ?= 49448 +PHP_FCGI_PORT ?= 49449 + + +serve: nginx.conf + nginx -p $(ROOT)/ -c $(ROOT)/$< + + +serve-php: + php-cgi -b 127.0.0.1:$(PHP_FCGI_PORT) + + +nginx.conf: nginx.conf.in + cat $< | \ + sed -e 's@__ROOT__@$(ROOT)@g' \ + -e 's@__HTTP_PORT__@$(HTTP_PORT)@g' \ + -e 's@__PHP_FCGI_PORT__@$(PHP_FCGI_PORT)@g' > $@ + + +.PHONY: serve diff --git a/docroot/nginx-serve b/docroot/nginx-serve deleted file mode 100755 index 50beb58..0000000 --- a/docroot/nginx-serve +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -HERE="$(dirname $(readlink -f $0))" -exec nginx -p $HERE/ -c $HERE/nginx.conf diff --git a/docroot/nginx.conf b/docroot/nginx.conf.in similarity index 75% rename from docroot/nginx.conf rename to docroot/nginx.conf.in index 2458611..34be73b 100644 --- a/docroot/nginx.conf +++ b/docroot/nginx.conf.in @@ -1,7 +1,6 @@ worker_processes 1; -error_log error.log; -pid server.pid; -worker_rlimit_nofile 8192; +error_log __ROOT__/error.log; +pid __ROOT__/server.pid; daemon off; @@ -11,7 +10,7 @@ events { http { - include mime.types; + include __ROOT__/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] $status ' @@ -22,10 +21,10 @@ http { autoindex on; server { - listen 49448; + listen __HTTP_PORT__; server_name localhost; access_log access.log main; - root /home/me/src/LearningPhp/src/docroot/html; + root __ROOT__/html; location / { index index.html index.txt index.php; @@ -33,7 +32,7 @@ http { location ~ \.php$ { include fastcgi_params; - fastcgi_pass 127.0.0.1:49449; + fastcgi_pass 127.0.0.1:__PHP_FCGI_PORT__; } } } diff --git a/docroot/php-serve b/docroot/php-serve deleted file mode 100755 index b69fb3c..0000000 --- a/docroot/php-serve +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -exec php-cgi -b 127.0.0.1:49449