Hosting ember project on apache2 server - how to structurize etc?


#1

Hi, I thought I’d give ember a try just to test it out and get some personal experience with it. I did the quick setup yesterday to have my first look. Now I want to see how to get this project up and running on a server.

I have a linode server with apache2 running on it. I’m still new to hosting websites.

Lets say I have a domain example.com. The the root of the web is example.com/public_html. Do I create the ember project in public_html? "ember new project_name" And then set the root of the project for the website as the ember projects app folder?


I am not able to deploy my Ember application while Hosting cpanel
#2

You can put this .htaccess file in your public folder and upload the complete dist folder to apache after ember build -environment production


#3

Hi, I have the similar problem, I try to deploy tutorial example on Apache according to https://guides.emberjs.com/v2.12.0/tutorial/deploying/.

For root url ‘http://localhost’ it works fine, but when I have more complicated url like ‘http://localhost/contact’ and then I refresh url I receive 404 error.

I enabled rewrite mod on httpd.conf (LoadModule rewrite_module modules/mod_rewrite.so) and added .htaccess file to root folder on apache ‘c:\Apache24\htdocs’ but it doesn’t work.

Do you have any idea what should I do to solve this problem?


#4

As a test put the .htaccess file in the "public" folder and deploy. Also set the ENV.rootURL = '/'; in config/environment.js if you deploy in the root.


#5

Thanks for the answer

I have .htaccesss in ‘super-rentals/public/’. After execute command ‘ember build --environment production’ the files from ‘public’ directory are added to ‘dist/’.

Content of dist direcotry I copied to ‘c:\Apache24\htdocs’. Also I have ENV.rootURL = ‘/’

var ENV = { modulePrefix: ‘super-rentals’, environment: environment, rootURL: ‘/’, locationType: ‘auto’, EmberENV: { FEATURES: { // Here you can enable experimental features on an ember canary build // e.g. ‘with-controller’: true }, EXTEND_PROTOTYPES: { // Prevent Ember Data from overriding Date.parse. Date: false } },

APP: {
  // Here you can pass flags/options to your application instance
  // when it is created
}

};


#6

I gave up with Apache, Now I deploy tutorial example on nginx-1.10.3 and it works fine.

In nginx.conf I added

    location / {
        root   html;
        try_files $uri /index.html;
    }

#7

Thank you, thank you, thank you and…THANK YOU! 3 days of pain around this. Solved.