Skip to content

Instantly share code, notes, and snippets.

@rubyonrailsworks
Last active December 11, 2015 05:48
Show Gist options
  • Select an option

  • Save rubyonrailsworks/4554820 to your computer and use it in GitHub Desktop.

Select an option

Save rubyonrailsworks/4554820 to your computer and use it in GitHub Desktop.
Passenger Vs UNICORN
<VirtualHost *:80>
ServerName xxx
ServerAlias xxx
RewriteEngine On
PassengerEnabled off
DocumentRoot /home/www/rails/icolor/current/public
RewriteCond /home/www/rails/icolor/current/public/%{REQUEST_URI} !-f
RewriteRule ^/system/?(.*) http://www.icolor.com.cn/system/$1 [L,R,NE]
RewriteRule ^/images/?(.*) http://www.icolor.com.cn/images/$1 [L,R,NE]
# Redirect all non-static requests to unicorn
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://unicornservers%{REQUEST_URI} [P,QSA,L]
<Proxy balancer://unicornservers>
BalancerMember http://127.0.0.1:3005
</Proxy>
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@localhost
RewriteEngine On
PassengerEnabled off
<Proxy balancer://unicornservers>
BalancerMember http://127.0.0.1:3005
</Proxy>
DocumentRoot /home/www/rails/icolor/current/public
<Directory /home/www/rails/icolor/current/public>
AllowOverride all
Options -MultiViews
</Directory>
Alias /phpmyadmin "/var/www/phpmyadmin"
<Directory "/var/www/phpmyadmin">
AllowOverride All
Options FollowSymlinks
Order allow,deny
Allow from all
</Directory>
Alias /21days "/var/www/21days/minisite"
<Directory "/var/www/21days/minisite">
AllowOverride All
Options FollowSymlinks
Order allow,deny
Allow from all
</Directory>
Alias /shuaxin "/var/www/shuaxin"
<Directory "/var/www/shuaxin">
AllowOverride All
Options FollowSymlinks
Order allow,deny
Allow from all
</Directory>
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !/phpmyadmin/.*
RewriteCond %{REQUEST_URI} !/21days/.*
RewriteCond %{REQUEST_URI} !/shuaxin/.*
RewriteRule ^/(.*)$ balancer://unicornservers%{REQUEST_URI} [P,QSA,L]
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment