How do I configure nginx to have a Rails app at a domain and WordPress at /blog/?
I've got a Rails app deployed via nginx/passenger. It will have multiple domains pointing to it.
I'm wondering if it's possible to configure nginx so that any URL that matches [somedomain.com]/blog/ will be servered by PHP/WordPress located in a different directory.
So, for example:
domain1.com, domain2.com, & domain2.com/some-resource/1 point to the Rails app at /var/rails/mainapp/
but domain1.com/blog/ goes to /var/site开发者_JAVA技巧s/domain1.com/
and domain2.com/blog/ goes to /var/sites/domain2.com/
server {
location /blog {
alias /var/sites/domain1.com/;
}
location / {
}
}
You need define you /blog before / location
Here is my config. Hope it helps someone.
# Redirect all requests containing 'www.your-website.ru' # to 'your-website.ru' server { listen 80; server_name www.your-website.ru; rewrite ^(.*) http://your-website.ru$1 permanent; } server { listen 80; server_name your-website.ru; access_log logs/your-website.ru.log; root /path-to-your-website.ru/current/public; ##################### # Rails ##################### location / { rails_env production; # this is a production server passenger_enabled on; #
精彩评论