Guest User

nginx.conf : nginx + php + userdir + phpmyadmin + redmine (passenger)

a guest
Nov 29th, 2010
2,810
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. #user http;
  3. worker_processes 1;
  4.  
  5. #error_log logs/error.log;
  6. #error_log logs/error.log notice;
  7. #error_log logs/error.log info;
  8.  
  9. #pid logs/nginx.pid;
  10.  
  11.  
  12. events {
  13. worker_connections 1024;
  14. }
  15.  
  16.  
  17. http {
  18. include mime.types;
  19. default_type application/octet-stream;
  20.  
  21. passenger_root /opt/ruby1.8/lib/ruby/gems/1.8/gems/passenger-3.0.0;
  22. passenger_ruby /usr/bin/ruby;
  23. passenger_max_pool_size 10;
  24.  
  25. #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  26. # '$status $body_bytes_sent "$http_referer" '
  27. # '"$http_user_agent" "$http_x_forwarded_for"';
  28.  
  29. #access_log logs/access.log main;
  30.  
  31. sendfile on;
  32. #tcp_nopush on;
  33.  
  34. #keepalive_timeout 0;
  35. keepalive_timeout 65;
  36.  
  37. #gzip on;
  38.  
  39. server {
  40. listen 80;
  41. server_name localhost;
  42.  
  43. #charset koi8-r;
  44. #access_log logs/host.access.log main;
  45.  
  46.  
  47. # Userdir - php
  48. location ~ ^/~([^/]+)/(.+\.php)$ {
  49. if (!-f /home/$1/public_html/$2) {
  50. rewrite ^ 404;
  51. }
  52. alias /home/$1/public_html/$2;
  53. fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
  54. fastcgi_index index.php;
  55. fastcgi_param SCRIPT_FILENAME $request_filename;
  56. include fastcgi_params;
  57. }
  58.  
  59. # Userdir - static
  60. location ~ ^/~([^/]+)(/.*)?$ {
  61. alias /home/$1/public_html$2;
  62. autoindex on;
  63. }
  64.  
  65. # PhpMyAdmin - php
  66. location ~ /phpmyadmin(.+\.php)$ {
  67. alias phpmyadmin/$1;
  68. fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
  69. fastcgi_index index.php;
  70. fastcgi_param SCRIPT_FILENAME $request_filename;
  71. include fastcgi_params;
  72. }
  73.  
  74. # PhpMyAdmin - static
  75. location /phpmyadmin {
  76. alias phpmyadmin;
  77. index index.php;
  78. }
  79.  
  80. # Redmine (Passenger)
  81. location /redmine {
  82. alias redmine/public;
  83. passenger_enabled on;
  84. passenger_base_uri redmine/public;
  85. }
  86.  
  87. # Default - php
  88. location ~ (.+\.php)$ {
  89. alias html/$1;
  90. fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
  91. fastcgi_index index.php;
  92. fastcgi_param SCRIPT_FILENAME $request_filename;
  93. include fastcgi_params;
  94. }
  95.  
  96. # Default - static
  97. location / {
  98. root html;
  99. autoindex on;
  100. index index.php index.html index.htm;
  101. }
  102.  
  103.  
  104. # redirect server error pages to the static page /50x.html
  105. #
  106. error_page 500 502 503 504 /50x.html;
  107. location = /50x.html {
  108. root html;
  109. }
  110. }
  111. }
RAW Paste Data