0

I have a meteor application I deployed using this method Deploy a meteor app which works fine and which now runs on mydomain.com:3000 but I want to have access to it on mydomain.com/myapp. For that I try to use apache2 with mods, following what I have read on the web my configuration is :

<VirtualHost *:80>
    ServerName mydomain.com

    Alias /myapp /home/me/Documents/myapp/bundle/public
    <Location /memo>
            PassengerBaseURI /myapp
            PassengerAppRoot home/me/Documents/myapp/bundle

            PassengerAppType node
            PassengerStartupFile main.js

    </Location>


    <Directory /home/me/Documents/myapp/bundle/public>
            Allow from all
            Options -MultiViews
    </Directory>


    ProxyPass /myapp http://localhost:3000/
    ProxyPassReverse /myapp http://localhost:3000/
</VirtualHost>

but when I go on mydomain.com/myapp I have a blank page while on mydomain.com:3000 this is working fine.

What's bad ?

EDIT: I'm wondering if the problem doesn't come from the meteor application because I have the title of the window at the top of my page (from my ) but the rest of the page is always empty.

So the redirection is working a little bit..

Could it be possible that my meteor app have difficulties to find his ressources because of the mydomain/myapp sub-uri and a mistake in the app configuration ? I have defined the ROOT_URL environment variable to mydomain.com/myapp

Community
  • 1
  • 1
taspai
  • 120
  • 1
  • 3
  • 13

2 Answers2

2

for me apache2 is not a good choice to do this, you should use nginx instead

example of configuration:

server {
    listen 80;

    server_name example.com www.example.com;

    location /myapp {
        proxy_pass http://localhost:3000/;
    }
}
  • 1
    Yes I have read that nginx is better for this kind of applications but I have others classic apps which runs with apache on mydomain/otherapps and if I set up nginx I will have conflicts with apache ! – taspai Sep 29 '16 at 21:25
0

Here is a setup I use to redirect /blog to a Meteor server (I don't use Passenger with Apache)

<VirtualHost *:80>
    ServerName myserver.com:80
    Redirect permanent / /blog/

    ProxyRequests Off
    ProxyVia Block
    ProxyPreserveHost On
    <Proxy *>
         Require all granted
    </Proxy>
# Meteor ghost blog
    ProxyPass /meteor/ http://172.31.1.11:3000/
    ProxyPassReverse /meteor/ http://172.31.1.11:3000/
</VirtualHost>

This works, but I must agree with @kalid-rafik that nginx is a much easier solution. Maybe you could ask for another ip address to use with nginx?

Mikkel
  • 7,693
  • 3
  • 17
  • 31
  • I have almost the same and I'm finally wondering if the problems doesn't come from the meteor app, I will edit my post to explain it. And I can't, it's for my own server. – taspai Sep 30 '16 at 07:01