daily pastebin goal
10%
SHARE
TWEET

Untitled

a guest Feb 19th, 2012 42 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. user  nginx;
  2. worker_processes  5;
  3.  
  4. error_log  /var/log/nginx/error.log warn;
  5. pid        /var/run/nginx.pid;
  6.  
  7.  
  8. events {
  9.     worker_connections  1024;
  10. }
  11.  
  12.  
  13. http {
  14.     include       /etc/nginx/mime.types;
  15.     default_type  application/octet-stream;
  16.  
  17.     log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
  18.                       '$status $body_bytes_sent "$http_referer" '
  19.                       '"$http_user_agent" "$http_x_forwarded_for"';
  20.  
  21.     access_log  /var/log/nginx/access.log  main;
  22.  
  23.     sendfile        on;
  24.     #tcp_nopush     on;
  25.  
  26.     keepalive_timeout  65;
  27.  
  28.     gzip  on;
  29.  
  30.     passenger_root /usr/lib/phusion-passenger;
  31.     passenger_ruby /usr/bin/ruby;
  32.  
  33.     index index.html index.htm index.php;
  34.  
  35.    
  36.     server {
  37.         listen 80 default_server;
  38.             server_name _;
  39.  
  40.             access_log /var/log/nginx/access.log main;
  41.  
  42.             root   /var/www/default;
  43.     }
  44.  
  45.     include /etc/nginx/conf.d/*.conf; # empty
  46.     include /etc/nginx/sites-enabled/*; # see below for example
  47. }
  48.  
  49.  
  50.  
  51.  
  52.  
  53. Some of the configs in sites-enabled:
  54.  
  55.  
  56. server {
  57.   listen          80;
  58.   server_name     java.test;
  59.   root            /var/www/test/java;
  60.  
  61.   gzip on;
  62.   gzip_proxied any;
  63.   gzip_types text/plain text/css application/javascript application/xml application/json;
  64.  
  65.   location / {
  66.     proxy_pass http://localhost:8810;
  67.     proxy_set_header X-Real-IP $remote_addr;
  68.   }
  69. }
  70.  
  71. server {
  72.   listen 80;
  73.   server_name test.php;
  74.   rewrite ^ $scheme://www.test.php$request_uri redirect;
  75. }
  76.  
  77. server {
  78.         listen 80;
  79.  
  80.         server_name www.test.php;
  81.  
  82.         root /var/www/test/php;
  83.  
  84.         access_log /var/log/nginx/test.php.access.log;
  85.         error_log /var/log/nginx/test.php.error.log;
  86.  
  87.         location / {
  88.     try_files $uri $uri/ /index.php?$uri&$args;
  89.   }  
  90.  
  91.   location /system/* {
  92.     return 403;
  93.   }
  94.  
  95.         # This block will catch static file requests, such as images, css, js
  96.         # The ?: prefix is a 'non-capturing' mark, meaning we do not require
  97.         # the pattern to be captured into $1 which should help improve performance
  98.         location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
  99.                 # Some basic cache-control for static files to be sent to the browser
  100.                 expires max;
  101.                 add_header Pragma public;
  102.                 add_header Cache-Control "public, must-revalidate, proxy-revalidate";
  103.         }
  104.  
  105.         location = /robots.txt  { access_log off; log_not_found off; }
  106.         location = /favicon.ico { access_log off; log_not_found off; } 
  107.         location ~ /\.          { access_log off; log_not_found off; deny all; }
  108.         location ~ ~$           { access_log off; log_not_found off; deny all; }
  109.  
  110.         location ~ \.php {
  111.         fastcgi_param  QUERY_STRING       $query_string;
  112.         fastcgi_param  REQUEST_METHOD     $request_method;
  113.         fastcgi_param  CONTENT_TYPE       $content_type;
  114.         fastcgi_param  CONTENT_LENGTH     $content_length;
  115.  
  116.         fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
  117.         fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
  118.         fastcgi_param  REQUEST_URI        $request_uri;
  119.         fastcgi_param  DOCUMENT_URI       $document_uri;
  120.         fastcgi_param  DOCUMENT_ROOT      $document_root;
  121.         fastcgi_param  SERVER_PROTOCOL    $server_protocol;
  122.  
  123.         fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
  124.         fastcgi_param  SERVER_SOFTWARE    nginx;
  125.  
  126.         fastcgi_param  REMOTE_ADDR        $remote_addr;
  127.         fastcgi_param  REMOTE_PORT        $remote_port;
  128.         fastcgi_param  SERVER_ADDR        $server_addr;
  129.         fastcgi_param  SERVER_PORT        $server_port;
  130.         fastcgi_param  SERVER_NAME        $server_name;
  131.  
  132.         fastcgi_pass unix:/tmp/php5-fpm.sock;
  133. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top