Created
April 10, 2015 12:09
-
-
Save zet4/aa7fa47adbecd147b1b8 to your computer and use it in GitHub Desktop.
Nginx Development Scripts
This file contains hidden or 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
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 /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
client_max_body_size 100m; | |
sendfile on; | |
server { | |
listen 8080; | |
server_name localhost; | |
root ROOT; | |
charset utf-8; | |
location / { | |
autoindex on; | |
index index.html index.htm index.php; | |
} | |
location ~ \.php$ { | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param QUERY_STRING $query_string; | |
fastcgi_param REQUEST_METHOD $request_method; | |
fastcgi_param CONTENT_TYPE $content_type; | |
fastcgi_param CONTENT_LENGTH $content_length; | |
fastcgi_param SCRIPT_NAME $fastcgi_script_name; | |
fastcgi_param REQUEST_URI $request_uri; | |
fastcgi_param DOCUMENT_URI $document_uri; | |
fastcgi_param DOCUMENT_ROOT $document_root; | |
fastcgi_param SERVER_PROTOCOL $server_protocol; | |
fastcgi_param HTTPS $https if_not_empty; | |
fastcgi_param GATEWAY_INTERFACE CGI/1.1; | |
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; | |
fastcgi_param REMOTE_ADDR $remote_addr; | |
fastcgi_param REMOTE_PORT $remote_port; | |
fastcgi_param SERVER_ADDR $server_addr; | |
fastcgi_param SERVER_PORT $server_port; | |
fastcgi_param SERVER_NAME $server_name; | |
# PHP only, required if PHP was built with --enable-force-cgi-redirect | |
fastcgi_param REDIRECT_STATUS 200; | |
fastcgi_pass unix:/run/php-fpm/php-fpm.sock; | |
fastcgi_index index.php; | |
} | |
} | |
} |
This file contains hidden or 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
#!/bin/bash | |
set -x | |
RELD="`dirname "$0"`" | |
ABSD="`realpath "$RELD"`" | |
if [ ! -e "$ABSD"/nginx.conf ]; then | |
sed "s,ROOT,$ABSD," < nginx.conf.template > nginx.conf | |
fi | |
exec nginx -c "$ABSD"/nginx.conf |
This file contains hidden or 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
#!/bin/bash | |
cd "`dirname "$0"`" | |
PIDFILE=nginx_user.pid | |
if [ -e "$PIDFILE" ]; then | |
set -x | |
kill `cat "$PIDFILE"` | |
rm -f "nginx.conf" | |
else | |
echo "No pidfile found at $PIDFILE" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment