Skip to content

Instantly share code, notes, and snippets.

@pcdinh
Created January 8, 2010 18:24
Show Gist options
  • Select an option

  • Save pcdinh/272254 to your computer and use it in GitHub Desktop.

Select an option

Save pcdinh/272254 to your computer and use it in GitHub Desktop.
./configure \
--prefix=/usr \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--http-client-body-temp-path=/var/lib/nginx/body \
--http-proxy-temp-path=/var/lib/nginx/proxy \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--user=www-data \
--group=www-data \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--without-select_module \
--without-poll_module \
--with-cpu-opt=opteron \
--with-md5-asm \
--with-sha1-asm \
--with-zlib-asm=pentiumpro \
--add-module=/home/sebastiaan/agentzh-headers-more-nginx-module-db9913e
Drupal
------
server {
listen 80;
# Strip "www." from the URL and redirect the old domain
server_name www.domain.com domain.com;
rewrite ^/(.*) $scheme://domain.com/$1 permanent;
}
server {
listen 80;
server_name pandion.im;
root /home/user/sites/domain.com;
index index.php index.xml index.html;
# Serve static file
try_files $uri @drupal;
# Clean URLs for Drupal
location @drupal {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
# Serve PHP scripts
location ~ .php$ {
# Prevent caching of admin panel
if ($query_string ~ q=admin) {
more_set_headers -s 200 "Cache-Control: no-cache, no-store, max-age=0";
}
# Forward to FastCGI daemon
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:10005;
}
}
phpMyAdmin
----------
server {
listen 80;
server_name phpmyadmin.domain.com;
root /usr/share/phpmyadmin;
index index.php;
# Serve PHP scripts
location ~ .php$ {
# Prevent caching
more_set_headers -s 200 "Cache-Control: no-cache, no-store, max-age=0";
# Forward to FastCGI daemon
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:10005;
}
# Authorize for setup
location /setup {
auth_basic "phpMyAdmin Setup";
auth_basic_user_file /etc/phpmyadmin/htpasswd.setup;
}
# Disallow web access to directories that don't need it
location /libraries {
deny all;
}
location /setup/lib {
deny all;
}
}
phpBB
-----
server {
listen 80;
server_name forums.domain.com;
root /home/user/sites/forums.domain.com;
index index.php index.htm;
# Serve PHP scripts
location ~ .php$ {
# Prevent caching of dynamic content
more_set_headers -s 200 "Cache-Control: no-cache, no-store, max-age=0";
# Forward to FastCGI daemon
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:10005;
}
# Security
location /cache {
deny all;
}
}
CoralCDN
--------
# CoralCDN caching of the download package
location = /download_setup.msi {
if ($http_user_agent ~ ^CoralWebPrx) {
break;
}
if ($query_string ~ (^|&)coral-no-serve$) {
break;
}
rewrite ^/(.*) $scheme://$host.nyud.net/$1? redirect;
}
Zend Framework
--------------
server {
listen 80;
server_name servername.com;
root /var/www/zendapp/public;
location / {
index index.php;
}
# Deny access to sensitive files.
location ~ (\.inc\.php|\.tpl|\.sql|\.tpl\.php|\.db)$ {
deny all;
}
location ~ \.htaccess {
deny all;
}
# Rewrite rule adapted from zendapp/public/.htaccess
if (!-e $request_filename) {
rewrite ^.*$ /index.php last;
}
# PHP scripts will be forwarded to fastcgi processess.
# Remember that the `fastcgi_pass` directive must specify the same
# port on which `spawn-fcgi` runs.
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
}
location = /50x.html {
root /var/www/default;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment