Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to point website domain to rails app via virtual host + centos + apache

I have dedicated server web hosting in Hostgator. - CentOs 6 64bit - Dedicated Server - Apache I had an dedicated host IP where I have created "A" record with IP(domain hosting is in GoDaddy).

My problem is creating virtual host to point rails app to my domain. I am trying to configure domain. I didn't find conf file where default document root is configured. I tried changing conf file in etc/httpd/conf/httpd.conf, but no use. Some default document root(/usr/local/apache/htdocs) page is rendering. I need to find the document root virtual configuration and then need to point my domain to that. I need help regarding this.

Here is my default virtualhost setting in httpd conf file:

NameVirtualHost *
# Default vhost for unbound IPs
<VirtualHost *>
    ServerName examle_server_name
    DocumentRoot /usr/local/apache/htdocs
    ServerAdmin root@example_server
    <IfModule mod_suphp.c>
        suPHP_UserGroup nobody nobody
    </IfModule>
</VirtualHost>

Even if I change Server name to my domain name there is no chnage. Also if I remove those lines, it is showing default page which is in /usr/local/apache/htdocs.

How/Where can I change this to effect/point my rails app to domain.

Also I need Apache VirtualHost settings of rails app configuration which is running on rails 3000 port

Help me please.

Regards, Ranjit

like image 931
Ranzit Avatar asked Oct 31 '22 06:10

Ranzit


1 Answers

For deploying apps in a server I use this virtual host configuration

<VirtualHost *:80>
    ServerName mydomain.com
    DocumentRoot /path/to/rails/public/folder


    <Directory /path/to/rails/public/folder >
        Options Indexes FollowSymLinks
        AllowOverride all
        Require all granted
    </Directory>

</VirtualHost>

I creata a file in /etc/apache2/sites-enabled/mysite.conf, but I do it in Ubuntu servers. I donn't know if the location in CentOS is the same.

You can create another file like this for the 3000 port app.

I skipped the Passengger (https://www.phusionpassenger.com/) settings in the file. I use it for serving rails apps.

After any changes you will need to restart the server

sudo service apache2 restart
like image 143
gsobrevilla Avatar answered Nov 10 '22 06:11

gsobrevilla