Last active
August 29, 2015 14:01
-
-
Save jedmund/fecac3dd0dbc55227ddf to your computer and use it in GitHub Desktop.
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
RewriteEngine on | |
DirectoryIndex index.php | |
RewriteRule ^$ /index.php [L] | |
RewriteRule ^home$ /index.php [L] | |
RewriteRule ^about$ /about.php [L] | |
RewriteCond %{REQUEST_METHOD} GET | |
RewriteRule ^made/([^/]*)$ /project.php?p=$1 [L] | |
RewriteCond %{REQUEST_METHOD} GET | |
RewriteRule ^/?([^/]*\.html?|[^\./]*)[:;,\.]*$ /page.php?p=$1 [L] |
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
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; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
# PHP only, required if PHP was built with --enable-force-cgi-redirect | |
fastcgi_param REDIRECT_STATUS 200; |
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
# user nginx; | |
worker_processes 1; | |
error_log /var/log/nginx/error.log warn; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | |
'$status $body_bytes_sent "$http_referer" ' | |
'"$http_user_agent" "$http_x_forwarded_for"'; | |
access_log /var/log/nginx/access.log main; | |
sendfile on; | |
#tcp_nopush on; | |
keepalive_timeout 65; | |
#gzip on; | |
server_names_hash_bucket_size 64; | |
include /etc/nginx/conf.d/*.conf; | |
include /etc/nginx/sites-enabled/*; | |
} |
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
# nginx configuration | |
index index.php; | |
location / { | |
rewrite ^/$ /index.php break; | |
if ($request_method ~ "GET"){ | |
rewrite ^/made/([^/]*)$ /project.php?p=$1 break; | |
} | |
if ($request_method ~ "GET"){ | |
rewrite "^/?([^/]*\.html?|[^\./]*)[:;,\.]*$" /page.php?p=$1 break; | |
} | |
} | |
location = /home { | |
rewrite ^(.*)$ /index.php break; | |
} | |
location = /about { | |
rewrite ^(.*)$ /about.php break; | |
} |
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
server { | |
listen 80; | |
server_name justinedmund.com www.justinedmund.com; | |
root /home/justin/www/jedmund.com/prod/public; | |
access_log /home/justin/www/jedmund.com/prod/logs/access.log; | |
error_log /home/justin/www/jedmund.com/prod/logs/error.log; | |
include fastcgi_params; | |
location / { | |
try_files $uri.php $uri/ /index.php?q=$uri&$args; | |
} | |
# remember that PHP-FPM status URL we setup? we want to support it for this | |
# vhost. so if the request is for /status, hand that back to | |
# PHP using our named upstream server | |
location /status { | |
fastcgi_pass php; | |
} | |
# this is identical, but for the ping URL we setup | |
location /ping { | |
fastcgi_pass php; | |
} | |
# and finally, the magic that makes PHP work. if the file being requested ends in ".php" | |
# it's something that PHP-FPM should process, so hand it to our named upstream server | |
location ~ \.php$ { | |
fastcgi_pass php; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment