Nginx Passenger Deploy Meteor App to Subdirectory - Fails to Load app site

29 views
Skip to first unread message

dmungas

unread,
Apr 11, 2017, 3:09:57 AM4/11/17
to Phusion Passenger Discussions
This is my first experience deploying a meteor app to my own server (Linux Ubuntu 14.04). Following the instruction in https://www.phusionpassenger.com/library/deploy/nginx/deploy/meteor/ for setting up a server with subdirectories for different apps I created the following server configuration in /etc/nginx/sites-available/default.conf (link added in /etc/nginx/sites-enabled):

server {
    listen 80;  

    root /var/www/html;
    server_name myserver.edu;
   
    passenger_enabled on;

     # index.html is a welcome html file in the root directory
     location / {
       try_files $uri $uri/ /index.html;
    }
   
    # site1 is a website hosted on this server
    location /site1 {
        index index.php;
    }
   

    location ~ ^/app1(/.*|$) {
        alias /var/www/html/app1/bundle/programs/web.browser/app$1;  # public folder of app1
        passenger_base_uri /app1;
        passenger_app_root /var/www/html/app1/bundle;
        passenger_document_root /var/www/html/app1/bundle/programs/web.browser/app;

        # Turn on Passenger
        passenger_enabled on;
        # Tell Passenger that your app is a Meteor app
        passenger_app_type node;
        passenger_startup_file main.js;
        # Tell your app where MongoDB is
        passenger_env_var MONGO_URL mongodb://localhost:27017/meteor;
        # Tell your app what its root URL is
        passenger_env_var ROOT_URL http://myserver.edu;

    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi.conf;
    }
 
    location /doc/ {
        alias /usr/share/doc/;
        autoindex on;
        allow 127.0.0.1;
        deny all;
    }

    location ~/\.ht {
        deny all;
    }

}

Nginx restarts and Passenger loads without any errors in the error log (/var/log/nginx/error.log). Entering the url <myserver.edu/app1> in a web browser loads a blank page. The browser web console shows 3 alerts:

1. Did not parse stylesheet at 'http://myserver.edu/8b9512ae31c83878e2fe79f333d95b9a54ffd187.css?meteor_css_resource=true' because non CSS MIME types are not allowed in strict mode.
2. Did not parse stylesheet at 'http://myserver.edu/1e14facc176dd0d8078423545ba184b95cc9ece4.css?meteor_css_resource=true' because non CSS MIME types are not allowed in strict mode.
3. SyntaxError: Unexpected token '<' # this is in the <html> tag on index.html

It appears that Passenger is not finding the html generated by the app. Are there configuration errors in the server settings?

Camden Narzt

unread,
Apr 12, 2017, 9:25:22 AM4/12/17
to Phusion Passenger Discussions
Please describe your app's directory structure. Also are you actually using php? If not remove the php configs.
Reply all
Reply to author
Forward
0 new messages